I have a Ubuntu LAMP with PHP installed as a module. Since it's a default LAMP server, Apache fetches /usr/bin/php to execute PHP. I have a PHP built in /opt/php/5.3.8 and I like to use this path instead. How can I tell Apache that? In default virtual host for localhost, I tried between my marks <VirtualHost *:80></VirtualHost>
:
<IfModule alias_module>
ScriptAlias /cgi-bin-php/ "/opt/php/5.3.8/bin"
</IfModule>
<Directory "/opt/php/5.3.8/bin">
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>
# Set the environment var for PHP to look for php.ini's
SetEnv PHP_INI_SCAN_DIR "/opt/php/5.3.8/lib/conf.d/"
AddHandler php-script .php
Action php-script /cgi-bin-php/php-cgi
I have a2enmod actions && /etc/init.d/apache2 restart
. But nothing happens ….
=== answer found ===
Okay I figured it out! If PHP is run by Apache as a module, then what you have to do is add that line in your Virtual Host:
LoadModule php5_module /my/php/distro/libs/libphp5.so
Best Answer
If PHP is run by Apache as a module, then what you have to do is add that line in your Virtual Host: