(Reprinted) the coexistence of php4 and Php5 has recently used a new PHP5, but does not want to affect the original PHP4. Therefore, we have found many ways to coexist, but they are not ideal. finally
I found a good article about coexistence using APACHE and using different ports, which is very convenient.
Download the PHP 4 for Windows Zip binary package, decompress it to any Directory (I decompress it to E: php), and rename php. ini-dist in it to php. ini. Copy php. ini and php4ts. dll to the windows installation directory.
Download the PHP 5 for Windows Zip binary package, decompress it to any non-PHP 4 Directory (I decompress it to E: php5), and rename php. ini-dist in it to php. ini.
Next, modify the httpd. conf file of Apache2. The key to modification is to use the IfDefine command: find the code:
Listen 80
This line, changed
Code: Listen 80 Listen 81
Add at the end of httpd. conf
Code:
LoadModule php4_module "e:/php/sapi/php4apache2. dll"
LoadModule php5_module "e:/php5/php5apache2. dll" PHPINIDir "e:/php5/php. ini"
AddType application/x-httpd-php. php AddType application/x-httpd-php. php3 AddType application/x-httpd-php. php4 AddType application/x-httpd-php. php5 AddType application/x-httpd-php-source. phps
Set other commands, such as DirectoryIndex and adddefacharcharset.
The next step is to create two Apache services with different running parameters. At the command prompt, go to the bin directory in the installation directory of Apache2 and run the code:
Apache-k install-D php = php5-n Apache2PHP5
In this way, a new Apache service named Apache2PHP5 contains the php5 running parameters is created.
Note: copy php5ts. dll under the php5 directory to c: \ winnt \ system32.
Then start the Apache2PHP5 service and restart the Apache2 service. you can start it in the management tools> service, or use the Monitor Apache Servers that comes with Apache 2 to start it.
Access http: // localhost/PHP 4 and access http: // localhost: 81/PHP 5.