phpapachemultiple-versions

Tell Apache to use a specific PHP version installed using phpbrew


I had the PHP, MySQL, and Apache stack installed for development. That installation is using configuration files from:

/etc/apache2/
/etc/php5/

Later I installed multiple PHP version using phpbrew. All versions are accessible and switchable from CLI. But Apache always stays on the default version that was not installed using phpbrew.

Here is a list of my installed PHP versions.

$ phpbrew list
Installed versions:
  php-5.4.13       (/home/admin1/.phpbrew/php/php-5.4.13)
                   +default -- --with-bz2=/usr
  php-5.5.5        (/home/admin1/.phpbrew/php/php-5.5.5)

  php-5.3.27       (/home/admin1/.phpbrew/php/php-5.3.27)

I have tried changing configuration file paths so they point to phpbrew's PHP. But nothing seems to be working.

How can I tell Apache to use phpbrew's PHP version?


Solution

  • You need to build a PHP with apxs2:

    1) Ensure your have installed sudo apt-get install apache2-dev.

    2) Run phpbrew install 5.4.22 +apxs2=/usr/bin/apxs2

    Then you should see the built module file in your Apache configuration file.