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.

5
  • I don't have the answer to your question but I wanted to make sure you knew there were backports available. webtatic.com/packages/php56 Commented Mar 2, 2016 at 2: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. Commented Mar 9, 2016 at 6:33
  • Did you run yum update before the install? It should work. Commented Mar 9, 2016 at 13:13
  • This is what I get when I run yum update: termbin.com/bbuo Commented Mar 13, 2016 at 18:02
  • 1
    For some reason you're missing webtatic. You should see something like: * webtatic: us-east.repo.webtatic.com Commented Mar 14, 2016 at 14:00

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.