Examples of coexistence of PHP3 and PHP4

Source: Internet
Author: User
Tags php and
I have been in the PHP3 environment debugging procedures, and later replaced by PHP4, I feel a lot of problems.
Mainly some of the original php3 under the normal operation of the program suddenly found in the php4 under a lot of problems.
And the original in the PhP4 of the program to the PHP3 also said that the XX function does not define or say that a function of the grammar is not complete or anything. Then suddenly remembered: can not put both of them on it? It's better to test the compatibility of the two programs.
 

The author refers to the installation and description of the PHP4/3 document does not specify the method, probably only said the two can be through the--enable-versioning instructions and DSO mode to achieve coexistence. How in the end is how a DSO? After the author N times repeatedly pondering the installation and configuration practices, the final success of both are successfully installed into the same Web server, usually. php3 files are resolved by PhP3, and. php files are parsed by PHP4.
 

The principle of implementation:

To implement two different versions of parsers working together, you must use the Enable-versioning directive, and when should you use it? This depends on which version of the parser is installed in the back, so this instruction only needs to be used when installing later. That is, if you are first installed PHP4 (This example is the case), after loading php3, then configure the php3 will add enable-versioning instructions. The converse is the same.
 

The following are installation configuration steps:

1, taking into account the author's own system mounted is PHP4, using the static mode, so if you want to use DSO, then only PHP3 adopted. But when did the enable-versioning add up? As the document is not clearly explained, the author can only test their own. About the configuration instructions to install Apache here is not much to repeat.
 

2, first compile and install PHP4, using static mode, the main instructions are as follows:

./configure--with-mysql=/www/mysql--with-apache=. /apache_1.3.12
>--enable-track-vars

3, note: Compile and install good php4, first will be Apache installation, otherwise the next step in the DSO mode installation and compile php3 when there is no way apxs script. and pay attention to!!!! IS, configure Apache to join the--enable-shared=max instruction (that is, using the DSO method) and then compile and install good Apache.
 

4, finally, configure and compile php3. After decompression, run:

./configure--with-mysql=/www/mysql--with-apxs=/www/httpd/bin/apxs
>--enable-versioning
Make
Make install

Generally there is no problem.
If the reader is using PHP4RC1 and other older PhP4, perhaps at compile time does not compile the contents of the Php4rc1 directory and only compile PhP3 directory content, then a solution is to compile the PHP4 after the PHP4RC1 directory change the name, so there is no problem.
 

Test: Generally as long as the smooth through the compilation and installation, then only need to modify the httpd.conf about PhP3 and PHP4 settings, and then restart Apache on it.
 

Two files test.php and test.php3 are created in the Htdocs directory, and PhP4 is displayed when the test.php is normally invoked and the TEST.PHP3 content is displayed.
TEST.PHP/TEST.PHP3 contents are as follows:

Phpinfo ();


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.