PHP4 and PHP5 coexist in a system _php tutorial

Source: Internet
Author: User
PHP4 and PHP5 coexist in a system

Seen in other places an article, a little older, these two days are also looking to find a time to use the Iis+apache with a different port to do two PHP coexistence .... Then send them again. Read the original.

-------------------------------------------------------------
The benefits are not much to say,:D What's the downside? Is the CGI way (quote official Original: We consider installing PHP like this Suicidal.--esayr Note: E is not good? Ah, the last one is suicide)
Say less nonsense, look directly at the method:

First, this article deals with software Extreme versions:
Windows PROFESSIONAL/XP
Apache 1.3.28 for WIN
Microsoft Internet Server Information (IIS6)
PHP 4.3.3 (4.3.5), PHP 5.0.0 Beta (5.0.0RC1)
MySQL 3.23.57 (3.23.58)


Two, approximate steps: (two, three optional)

1. Install each version of PHP separately

2. Install Apache, set up Apache and PHP

3. Install IIS and set PHP versions in IIS [Note 1]

4. Install MySQL


Three, prepare before installation:
Copy the required program to each folder, this article according to the following directory structure, you can modify ^ ^ According to your own needs:


C:/httpd/apache
C:/httpd/mysql
C:/httpd/php4
C:/httpd/php5
C:/httpd/php-includes
C:/httpd/phpmyadmin
C:/httpd/tmp
C:/httpd/www

To the C:/WINNT/SYSTEM32/DRIVERS/ETC (XP is c:/windows/system32/drivers/etc) folder, locate the Hosts file (no?! @_@ so ...:D), add at the bottom

127.0.0.1 PhP4 # Waiter PHP 4
127.0.0.1 php5 # Waiter PHP 5


Roar ... If you understand ~ ~ Modify Other names yourself 8D We continue to ...
Save File ...


Four, install each version of PHP
Suppose you have downloaded all the versions of PHP you need ... (which download??:P find it yourself ...)
Here take 4.3.3 and 5.0.0-beta as an example ... (4.3.5vs5.0.0rc1 I tried too. If it's not the same as your environment, don't blame me:(, much the same, I think about it);)

㈠ installation PHP4.3.3
① Unzip the download file (:) The people of the Earth know)
② PHP4.3.3 Php.exe, php.ini-recommended, Phpêmbed.lib, Php4ts.dll, Php4ts.lib, Dll/*.* and Extensions/*.* to c:/httpd/ PHP4
③ Modifying php.ini-recommended:
Extension_dir = "c:/httpd/php4/extensions/"
Cgi.force_redirect = 0
Save As PHP.ini (just under c:/httpd/php4/)

㈡ installation Php5.0.0beta
① decompression ...
② copies Php.exe, php.ini-recommended, Phpêmbed.lib, Php4ts.dll, Php4ts.lib, Dll/*.* and Extensions/*.* to C:HTTPDPHP5
If it is PHP5.0.0RC1, then there is no DLL and extensions directory, only ext--is extensions pull
If... You're a loyal user of MySQL, and don't forget to cuff libmysql.dll too [Note 2].
③ Modifying php.ini-recommended:
Extension_dir = "c:/httpd/php5/extensions/"
Cgi.force_redirect = 0
If it is php4.0.0rc1, then Extension_dir = "c:/httpd/php5/ext/"
Save As PHP.ini (just under c:/httpd/php5/)


Five, configure Apache
Open c:/httpd/apache/conf/httpd.conf and add some settings at the bottom:


ServerAdmin test@php433
ServerName PHP4
Serveralias www
DocumentRoot "C:/httpd/www"

Options Indexes followsymlinks MultiViews
AllowOverride None
Order Allow,deny
Allow from all

scriptalias/php4/"c:/httpd/php4/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php4/php.exe"



ServerAdmin test@php500
ServerName PHP5
DocumentRoot "C:/httpd/www"

Options Indexes followsymlinks MultiViews
AllowOverride None
Order Allow,deny
Allow from all

scriptalias/php5/"c:/httpd/php5/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php5/php-cgi.exe"

Six, about PHP5 and MySQL
MySQL installation, I will not say more, I put it down ... (Skip this paragraph, okay?)
You can load MySQL by modifying the php.ini. (Sad ...)

Seven, test ...
Start Apache (if the httpd.conf configuration is wrong, there will be an error prompt ...), then the address bar input HTTP://PHP4 and http://php5 to start PHP4 and PHP5 respectively ... Is it cool? :D:D:D [Note 3]
Believe that the vast number of PHP programmers, and want to learn PHP5 and do not want to give up PHP4 comrades, this will be a good way. ENJOY it!

To summarize:
In fact, the idea is very simple, the use of CGI to achieve the coexistence of PHP4 and PHP5. I found a lot of information, this is the simplest and most practical. But only for everyone to play this machine, do not do this on the server ... Otherwise ~ The consequence is self-esteem ... Don't look for me.

If you have a problem with the method above, you can try other ways, here are some examples of foreign success:
Http://wiki.coggeshall.org/37.html
Http://www.circle.ch/blog/p1387.html
Http://www.schlitt.info/applications/blog/..._5_prallel.html

Interested can continue to study under ...


Continuation of a significant complement to the programme:

PHP4 and PHP5 coexist, there is a problem of php.ini conflict ...
As you all know, the general practice is to copy the php.ini to the System folder (C:winnt or c:windows). If you install multiple versions at the same time, it is bound to cause conflicts ...

In fact, if you read the PHP installation document carefully, there will be the following text:
Does Where C I cut to could the php.ini? The php.ini files are only searched in and places:1) in your Apache installation directory (e.g. C:apacheapache) 2) R%SYSTEMROOT% Directory.

And we're just using the first way ... (Did the authorities expect this to happen??) GOD KNOWS ...)

I tested successfully in the above environment ... If you encounter difficulties, you can leave a message or discuss it with the discussion area.

Conclusion:
I'm not very good at writing tutorials and stuff like that ... I read it, but it is not easy for others to understand, we have to be patient.
Although the process is relatively simple, but it took me a lot of time (there are two places ...) I was looking for the wrong information, and I was badly hurt, this big a testified to pull ... (:D Big a slept up the toilet, I was still ... This is not suitable for children, delete 500 words)

PHP5 era more and more close, hurriedly understand go ...

-------------------------------------------------------------------------
[Note 1]:
Originally wanted to write for IIS ... But I really don't want to put a useless thing on my machine (:(for me), so ... The title column, but gave up writing ... Say sorry to some spectators ...

[Note 2]:
Here said humorous: In the PHP5.0.0RC1, do not know that you see a mysqli.dll under the ext, and php.exe the same level under the directory there is a libmysqli.dll it? What the hell is this? This is the official new version of MySQL (4.1.0 seems to be ... BAR) for an upgrade, for the high version MySQL players can try ... is said to support MySQL some new features OH

[Note 3]:
When you start Apache, if you see anything "overlap on port 80" ... Don't worry, in the httpd.conf, put Namevirtualhost *:80 before the comments go ... (This place is very difficult for me for a long time ...) It's only strange that Apache settings are unfamiliar. But this time is good to the Apache set up to see all over, or there is a harvest)


Related articles
Apache 2.2.2 + PHP5.1.4 cannot run the workaround. -05-11 02:07 pm-click: 12651
php5.1.3 Release-05-03 09:41 pm-click: 1860
PHP5 Study notes--Classes and Objects in php5-09-05 02:13 pm-click: 5776
• Upgrade from php4.3.* to php5.0.0-08-09 01:49 am-click: 5136
Comparison of configurations between PhP4 and php5-08-01 06:25 pm-Hits: 4260
Redhat 9 under Configuration APACHE2.0.50 +PHP5+MYSQL4.0.20+GD Library-07-29 02:00 am-click: 13784
php5 for Windows installation in detail-07-14 10:33 pm-Hits: 13370
PHP5 version released yesterday--with PHP research Manual-07-14 10:04 pm-click: 6069
• For object-oriented PHP5 II-06-25 07:13 PM-click: 3749
• For object-oriented PHP5 (1)-06-25 07:11 pm-click: 4488

http://www.bkjia.com/PHPjc/316906.html www.bkjia.com true http://www.bkjia.com/PHPjc/316906.html techarticle PHP4 and PHP5 coexist in a system seen elsewhere in an article, a little older, these two days are also looking to find a time to use the Iis+apache with different ports to do two PHP coexistence .... To be sent again ...

  • 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.