1

I'm following these two articles to install multiple versions of PHP while compiling from source: http://www.sitepoint.com/run-multiple-versions-php-one-server/ http://www.phpinternalsbook.com/build_system/building_php.html

I'm trying to install PHP 5.6 into /opt/php56 (a directory I've created) however, when I run ./buildconf and then run the following, PHP overwrites itself.

How I compile PHP:

./buildconf (does its thing)...

./configure \
--prefix-dir=/opt/php56/ \
--disable-opcache \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-gd-native-ttf \
--enable-libxml \
--with-libxml-dir=/opt/xml2/ \
--enable-pdo=shared \
--with-pdo-mysql=shared \
--with-pdo-sqlite=shared \
--enable-sockets \
--prefix=/usr/local \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-curl=/opt/curlssl/ \
--with-freetype-dir=/usr \
--with-gd \
--with-imap=/opt/php_with_imap_client/ \
--with-imap-ssl=/usr \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-libdir=lib64 \
--with-mcrypt=/opt/libmcrypt/ \
--with-mysql=/usr \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-openssl=/usr \
--with-openssl-dir=/usr \
--with-pcre-regex=/opt/pcre \
--with-pic \
--with-png-dir=/usr \
--with-xpm-dir=/usr \
--with-zlib \
--with-zlib-dir=/usr \
--enable-soap \

 make 
 make install (which installs everything to /usr/local/bin, despite the set prefix on ./configure). 

What happens when I run the following:

root ~>># which php
/usr/local/bin/php

root ~>># sudo -u foo which php
/usr/bin/php

What am I doing wrong with the --prefix ? The last install I did, I ran ./configure --prefix=/opt/php56/ and this too didn't take.

dasbuilder
  • 43
  • 7
  • I don't have the answer to your question but I wanted to make sure you knew there were backports available. https://webtatic.com/packages/php56/ – Matt Mar 02 '16 at 02:18
  • Thanks, however I followed the settings for adding that repo and whenever I tried yum install php56w, yum said there was no package available. – dasbuilder Mar 09 '16 at 06:33
  • Did you run yum update before the install? It should work. – Matt Mar 09 '16 at 13:13
  • This is what I get when I run yum update: http://termbin.com/bbuo – dasbuilder Mar 13 '16 at 18:02
  • 1
    For some reason you're missing webtatic. You should see something like: `* webtatic: us-east.repo.webtatic.com` – Matt Mar 14 '16 at 14:00

1 Answers1

1

The issue was that I was not telling the compiler where I wanted my directories. Case in point:

./configure \
--prefix=/opt/php56 \
--bindir=/opt/php56/bin \
--libdir=/opt/php56/lib \
--sysconfdir=/opt/php56/etc \
--includedir=/opt/php56/include/php \
--mandir=/opt/php56/php/man \

... the rest has been left off for brevity.

dasbuilder
  • 43
  • 7