Coexistence of APACHE-based PhP4 and PhP5 in windws

Source: Internet
Author: User
Tags temporary file upload

Introduction: This is a detailed page of APACHE-based PhP4 and PhP5 co-existence under windws. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 324029 'rolling = 'no'>
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. The following describes my installation method. I think it is more optimized and easy to upgrade.

For ease of introduction, first introduce my 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 in Area D: \ apache2, D: \ PhP4, D: \ PhP5). Configure two IP addresses 192.168.0.2 and 192.168.0.3 for the NIC (this article does not focus on configuring multiple IP addresses ). The modular Installation Method of Apache is introduced as an example below:

1. install and configure the Apache 2.0.55 server. After you agree to the license agreement, the server information page will be displayed for local debugging. The first two inputs are localhost. Edit the httpd. conf file and locate servername localhost: 80 and listen 80 respectively. Add # in front to close the settings.

2. Prepare PHP. Extract 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 respectively. Because there are two versions of PHP, You need to configure them separately. Copy a copy of PHP. ini-recommended and rename it as PHP. In.
Digress: the obsolete method should be processed 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. It will be difficult to upgrade later. The reasons are as follows.

4. Modify the Windows PATH variable. Join

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, so we do not need to delete the original files one by one. You can view how to modify the path here.

5. Modify PHP. ini respectively. Modify extension_dir and extension_dir. Find the above variables in PHP. ini and add the appropriate path. I modified it like this in PHP. ini of PhP4.

Extension_dir = "D: \ PhP4 \ extensions \"
And

Include_path = "D: \ PhP4 \ pear; D: \ PhP4 \ des"
PHP. ini in PhP5

Extension_dir = D: \ PhP5 \ ext
And

Include_path = "D: \ PhP5 \ pear; D: \ PhP5 \"
In fact, you also need to modify many other parameter values in PHP. ini, such as the temporary file upload path, session path, mail setting, and extension module configuration (in PhP5, to support MySQL, remove the followingCodeNumber)

; Extension = php_mysql.dll
However, because it is not the focus of this article, we will not detail it in detail.

6. Modify httpd. conf. Add the following code at the end:

<Ifdefine! PhP5>
Listen 192.168.0.2: 80
Loadmodule php4_module "D:/PhP4/SAPI/php4apache2. dll"
Phpinidir "D:/PhP4/PHP. ini"
</Ifdefine>

<Ifdefine PhP5>
Listen 192.168.0.3: 80
Loadmodule php5_module "D:/PhP5/php5apache2. dll"
Phpinidir "D:/PhP5/PHP. ini"
</Ifdefine>

Addtype application/X-httpd-PHP. php. phtml. php3. PhP4
Addtype application/X-httpd-PHP-source. PHPs

Here is a proper explanation:

Phpinidir = "D: \ PhP4"
Apache is told to search for PHP in the "D: \ PhP4" path. INI file, so we will not have PHP. INI is copied to other directories, and two PHP files are processed. ini. Ifdefine is an Apache command, which can be found in the Apache manual.
Set other commands of HTTP. conf, such as directoryindex and adddefacharcharset.

7. Create the apache service of PhP5. Run the following command on the command line:

Apache-K install-D PhP5-N Apache2-PHP5
That is, a service item with the PhP5 run parameter named Apache2-PHP5 is created in windows, which can be started in Administrative Tools> services, or by using the monitor Apache servers that comes with Apache 2. You can only run any PHP or simultaneously.

8. debug PHP. Use the following address to debug PhP4

Http: // 192.168.0.2
Use the following address to debug PhP5

Http: // 192.168.0.3
(You can set the IP address for specific installation)
Note: Because the path is modified, you must restart the system to take effect. After configuring PHP. ini or HTTP. conf, you must restart Apache to make the configuration take effect.

More articles on Apache-based PhP4 and PhP5 coexistence in windws

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/324029.html pageno: 15.

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.