Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: problem running 2 versions of php |
|
| Author |
|
sambache
Joined: 11 Feb 2014 Posts: 15 Location: Canada, Yorkton, Sk
|
Posted: Sat 15 Nov '25 3:59 Post subject: problem running 2 versions of php |
|
|
running apache with one php version (8.3.27) with fast_cgi with no problems I am in need to add a different (older) version for one particular virtual host. Both php versions are installed in d:\apache\php (main version) and in d:\apache\php5 (version for the particular virtual host). Created a phpinfo file in this particular virtual host, called the phpinfo and it shows me php8.3.27 with the php.ini of the older version. I must be missing something, but what? Hopefully someone here can shed some light on the error I am having.
php settings in httpd.conf
---------------
LoadModule fcgid_module modules/mod_fcgid.so
<Files ~ "\.php$>"
AddHandler fcgid-script .php
FcgidWrapper "D:/apache24/php/php-cgi.exe" .php
</Files>
FcgidInitialEnv PATH "D:/apache24/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
# Location php.ini:
FcgidInitialEnv PHPRC "D:/apache24/php"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
-------------------
php setting in that particular virtual host
----------------
DocumentRoot "${SRVROOT}/htdocs/analytics"
<Directory "${SRVROOT}/htdocs/analytics">
AllowOverride None
Options ExecCGI
Require all granted
</Directory>
<Files ~ "\.php$>"
AddHandler fcgid-script .php
</Files>
FcgidInitialEnv PHPRC "D:/Apache24/php5"
FcgidInitialEnv PATH "D:/Apache24/php5"
FcgidWrapper "D:/apache24/php5/php-cgi.exe" .php
What is wrong with my configuration ? |
|
| Back to top |
|
sambache
Joined: 11 Feb 2014 Posts: 15 Location: Canada, Yorkton, Sk
|
Posted: Mon 17 Nov '25 0:50 Post subject: |
|
|
found the error and got it fixed. Serving now 3 different versions.
Fix:
httpd.conf, only loading the fcgi module and telling apache to serve .php files with fcgi. If for all versions the additional parameters are the same, they can be left in httpd.conf otherwise they would have to be moved into the conf file for the specifi version.
httpd.conf entry would look like:
-------
LoadModule fcgid_module modules/mod_fcgid.so
<Files ~ "\.php$>"
AddHandler fcgid-script .php
</Files>
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
-----------
php84.conf
Now for each version of php create a .conf file in /conf/extra/php84.conf and place the php info there, for php8.4 as an example:
<IfModule fcgi_module>
FcgidInitialEnv PHPRC "D:/Apache24/php84"
FcgidInitialEnv PATH "D:/Apache24/php84"
FcgidWrapper "D:/apache24/php84/php-cgi.exe" .php
</IfModule>
httpd-vhost.conf
To tell Apache to load a specific php version for the specific virtual host add an entry like
Include conf/extra/php84.conf
Change the drive letters according to your setup.
Restart Apache and test with a phpinfo file. |
|
| Back to top |
|
Otomatic

Joined: 01 Sep 2011 Posts: 291 Location: Paris, France, EU
|
Posted: Mon 17 Nov '25 17:51 Post subject: |
|
|
Hi,
I do it differently, but I'm on Windows.
- Fichier httpd.conf:
| Code: |
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
FcgidMaxProcessesPerClass 300
FcgidConnectTimeout 10
FcgidProcessLifeTime 0
FcgidMaxRequestsPerProcess 0
FcgidMinProcessesPerClass 0
FcgidFixPathinfo 0
FcgidZombieScanInterval 20
FcgidMaxRequestLen 536870912
FcgidIOTimeout 120
FcgidTimeScore 3
FcgidPassHeader Authorization
Define PHPROOT ${INSTALL_DIR}/bin/php/php
</IfModule>
|
Next, I modify only the VirtualHosts by adding:
| Code: |
<IfModule fcgid_module>
Define FCGIPHPVERSION "8.3.27"
FcgidInitialEnv PHPRC ${PHPROOT}${FCGIPHPVERSION}
<Files ~ "\.php$">
Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "${PHPROOT}${FCGIPHPVERSION}/php-cgi.exe" .php
</Files>
</IfModule>
|
|
|
| Back to top |
|
|
|
|
|
|