Running Apache with multiple PHP fcgis
I now set up my local windows dev system with apache httpd and php to use fcgi and allow multiple PHP versions; especially so I can run PHP 5.2 with Ice 3.3 as well as PHP 5.3 with Ice 3.4 at the same time, without reconfiguration and restart.
I already wrote once about setting apache httpd up for fcgi and suEXEC, and this one could be called similar. But ofc. it was a pain in the ass, with non-talking error messages all over.
If you’re installing or updating to PHP 5.2.14 make sure to use php_curl from version 5.2.13, as the new one falsely requires a dll.
(Also, php_curl failed entirely with my php5.2.14 threadsafe, the 5.2.13 one as well…)
Also, I set FcgidFixPathinfo to 0, as 1 didn’t quite work and I am still using PHP 5.2 as well.
In short, what I did, or rather how it looks like now:
<IfModule !fcgid_module> LoadModule fcgid_module modules/mod_fcgid.so <IfModule fcgid_module> AddHandler fcgid-script .php # Maximum requests a process handles before it is terminated FcgidMaxRequestsPerProcess 1000 # if cgi.fix_pathinfo is set to 1 in php.ini: # http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidfixpathinfo ; http://php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo ; available since php 4.3 FcgidFixPathinfo 0 # Maximum number of PHP processes FcgidMaxProcesses 3 # Number of seconds of idle time before a process is terminated FcgidIOTimeout 240 FcgidIdleTimeout 240 FcgidConnectTimeout 20 # PHP 5.2.14 FcgidInitialEnv PHPRC "D:\pathto\PHP\php5.2.14\conf" FcgidWrapper "D:\pathto\PHP\php5.2.14\php-cgi.exe" .php #FcgidCmdOptions "D:\pathto\PHP\php5.2.14_nts\php-cgi.exe" InitialEnv PHPRC=D:\pathto\PHP\php5.2.14_nts\conf #FcgidWrapper "D:\pathto\PHP\php5.2.14_nts\php-cgi.exe" .php </IfModule> </IfModule>
And in my VirtualHost:
FcgidCmdOptions "D:\pathto\PHP\php-5.3.3-Win32-VC9-x86\php-cgi.exe" InitialEnv PHPRC=D:\pathto\PHP\php-5.3.3-Win32-VC9-x86\conf FcgidCmdOptions "D:\pathto\PHP\php-5.3.3-Win32-VC6-x86\php-cgi.exe" InitialEnv PHPRC=D:\pathto\PHP\php-5.3.3-Win32-VC6-x86\conf <Directory "G:\www\php53"> #FcgidWrapper "D:\pathto\PHP\php-5.3.3-Win32-VC9-x86\php-cgi.exe" .php FcgidWrapper "D:\pathto\PHP\php-5.3.3-Win32-VC6-x86\php-cgi.exe" .php Options +ExecCGI </Directory>
To get the depended on dlls of php_ice I used dependency walker and copied those required ones to the php folder.
For Ice 3.3:
For Ice 3.4: