Php4 and Php5 coexist

Source: Internet
Author: User
(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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.