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
link|improve this question
"PHP installed as a module ... Apache fetches /usr/bin/php to execute PHP." Is this really what you believe? – Ignacio Vazquez-Abrams Sep 28 '11 at 9:47
Unfortunalety yes :( Does it fetch from somewhere else? – François ッ Vespa ت Sep 28 '11 at 10:06
Good job. You should post that as your answer so this question will close. – jdw Sep 28 '11 at 12:40
@jdw thanks! Unfortunately I don't have enough reputation for that so I have to wait a couple of hours to do so – François ッ Vespa ت Sep 28 '11 at 13:21
feedback

2 Answers

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
link|improve this answer
feedback

If you are using PHP as a module, this means that the "interpreter" is a library loaded either via static compilation or a shared library (the latter of which is demonstrated via Francois' LoadModule example.) There would be no meaningful interpreter path in such a case. If you want to use your custom compiled CGI, you will first (normally) want to stop loading the module version.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.