Coexistence of Apache-based PHP4 and PHP5 in Windws

Source: Internet
Author: User
PHP4 and PHP5 may be used at the same time during PHP learning. There are also many installation methods on the Internet for the coexistence of the two, mostly installed under IIS and Apache. Next, let's take a look at my own installation method. I think it is more optimized than I think, and PHP4 and PHP5 may not be used in learning PHP at the same time. There are also many installation methods for coexistence of the two on the Internet, most of them are installed under IIS and Apache. Next, let's take a look at my installation method. I think it is more optimized and very convenient to upgrade.
  
For the sake of convenience, first let me introduce my own installation environment: Windows XP Pro SP2, Apache 2.0.55, PHP4.4.1, PHP5.1.1, all installed in D: \ (the following folder d is available in area D: \ apache2, d: \ php4, d: \ php5), configure two IP addresses 192.168.0.2 and 192.168.0.3 for the network adapter (how to configure multiple IP addresses is not the focus of this article ). The following uses the modular installation method of Apache as an example:

1. install and configure the Apache 2.0.55 server. After the permit protocol is approved, the page for entering server information will be displayed, for local debugging. The first two will be entered into localhost. Compile the httpd. conf file and locate ServerName localhost: 80 and Listen 80. Add # in front to close the settings.

2. prepare PHP. Decompress the downloaded php package (for example, php-5.1.1-win32.zip) and place it to d: \ php4 and d: \ php5.

3. configure php. ini. Because there are two versions of PHP, the configuration should be distinguished. Copy a copy of php. ini-recommended and rename it as php. in, and put it in the original path.
Digress: The expiration method should be handled in this way. copy php. copy the INI file to the installation folder of x: \ winnt (x: \ windows) or apache, and copy x: \ php \ php5ts. dll, php4ts. dll and other dll files to the winnt (windows), winnt \ system32, or apache installation folder. I strongly recommend that you do not do this. in the future, the upgrade will be more troublesome. The reasons are as follows.

4. modify the windows path variable. Participate

D: \ php4; d: \ php5
Go to the path environment variable to tell the system where to find php5ts. dll and other dynamic link library files, so we do not need to copy these dll files to % windir %, so it is much easier to upgrade PHP, and you do not need to delete those files one by one. You can view how to modify the path here.

5. correct php. ini. It is important to modify extension_dir and extension_dir. Locate the above variables in php. ini and take the appropriate path. I fixed it like this. in php. ini of PHP4

Extension_dir = 'd: \ php4 \ extensions \'
And

Include_path = 'd: \ php4 \ pear; d: \ php4 \ shortdes'
Php. ini in PHP5

Extension_dir = D: \ php5 \ ext
And

Include_path = 'd: \ php5 \ PEAR; D: \ php5 \'
In general, php needs to be modified. many other parameter values in ini, such as the temporary file Upload path, Session temporary path, mail setting, and extended module configuration (in PHP5, to support mysql, remove the number in the following code)

; Extension = php_mysql.dll
But because it is not the focus of this article, it is not specific.

6. modify httpd. conf. Finally, run the following code:


Listen 192.168.0.2: 80
LoadModule php4_module 'd:/php4/sapi/php4apache2. dll'
PHPiniDir 'd:/php4/php. ini'



Listen 192.168.0.3: 80
LoadModule php5_module 'd:/php5/php5apache2. dll'
PHPiniDir 'd:/php5/php. ini'


AddType application/x-httpd-php. php. phtml. php3. php4

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.