Recently to use the new PHP5, but do not want to affect the original PHP4, so found a lot of coexistence methods, but are not ideal, and finally
Found a better article, speaking of the use of Apache to achieve coexistence, with different ports, very convenient, is reproduced as follows
Download PHP 4 for Windows Zip binary package, unzip to any directory (I extracted to e:php), the inside of the php.ini-dist renamed to PHP.ini. Copy php.ini and Php4ts.dll to the Windows installation directory.
Download PHP 5 for Windows Zip binary package, unzip to any non-PHP 4 directory (I extracted to e:php5), the inside of the php.ini-dist renamed to PHP.ini.
Modify the Apache2. httpd.conf file below. The key to the modification is to use the Ifdefine directive: Find the Code:
Listen 80
This line, revision changed to
Code: Listen Listen Bayi
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
Other directives, such as DirectoryIndex and Adddefaultcharset, should be set by themselves.
The next step is to create two Apache services with different operating parameters. At the command prompt, go to the bin directory in the Apache2 installation directory and run the code:
Apache-k install-d php=php5-n APACHE2PHP5
This creates a new Apache service with php5 running parameters, named APACHE2PHP5.
Note that it is also important to copy the Php5ts.dll under the PHP5 directory to C:\Winnt\System32
Then start the APACHE2PHP5 service and restart the Apache2 service, which you can start in the management tools--services, or using Apache 2 's Monitor Apache Servers.
Accessing http://localhost/is PHP 4, and accessing http://localhost:81/is using PHP 5.