Is there any possibility to define shell alias for commands executed via php system
, exec
etc functions?
I'm running multiple versions of PHP using fastcgi and I need to run the right version of PHP when I execute
exec('php -f script.php');
inside web application, so for some vhosts calling php
I need to run /usr/bin/php
and for others e.g. /opt/php5.2.4/bin/php
.
My virtual vhost configuration looks like this
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /var/www/test.loc/www.test.loc/cgi-bin/php52.fcgi
</IfModule>
And php52.fcgi
(php55.fcgi respectively):
#!/bin/sh
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=200
export PHPRC="/opt/php5.2.4/php.ini"
exec /opt/php5.2.4/bin/php-cgi
So every vhosts has it's own php5x.fcgi script and php.ini file.