PHP3 and PHP4 Coexistence instance _php Tutorial

Source: Internet
Author: User
The author has been in the PHP3 environment debugging procedures, and later replaced PhP4, I feel a lot of problems.
Mainly some of the original php3 under the normal operation of the program suddenly found in PhP4 a lot of problems.
And the original in the PHP4 under the program to the PHP3 and said that the XX function does not define or say a function syntax is not complete or something. Then suddenly remembered: can not be put on both? The test program for the compatibility of the two AH.
 

I refer to the PHP4/3 installation and description of the document does not specify the method, probably only said that the two can be--enable-versioning instructions and DSO mode to achieve coexistence. So how is the DSO? After the author n times the installation and configuration practice, and finally successfully installed both in the same Web server, all. php3 files are parsed by PhP3, and. php files are parsed by PHP4.
 

The principle of implementation:

To implement coexistence of two different versions of parsers, 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, then this command only needs to be used in the later installation. That is, if you are first loaded PHP4 (this is the case), after loading php3, then the configuration php3 will add enable-versioning instructions. In turn, it is the same reason.
 

The following are the installation configuration steps:

1, considering the author's own system is PHP4, using the static mode, so if you want to use DSO, then only the php3 adopted. But when did the enable-versioning add? As the document is not clearly stated, the author can only test their own. The configuration instructions for installing Apache are not much more.
 

2, first compile and install PHP4, the use of 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, the first to install Apache, or the next step in the DSO mode installation and compilation php3 when there is no way to Apxs script. and pay attention to!!!! is to configure Apache to add--enable-shared=max instructions (that is, using the DSO method) and then compile and install Apache.
 

4. Finally, configure and compile the php3. After decompression, run:

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

In general, basically no problem.
If the reader is using PHP4RC1 and other older PhP4, perhaps in the compile time will not compile Php4rc1 directory content and only compile PhP3 directory content, then a solution is to compile PHP4 after the Php4rc1 directory change 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 can be.
 

Create two files test.php and test.php3 under the Htdocs directory, and normally call test.php to display the contents of PHP4 and Invoke test.php3 to display the contents of PHP3.
TEST.PHP/TEST.PHP3 content is as follows:

Phpinfo ();


http://www.bkjia.com/PHPjc/629889.html www.bkjia.com true http://www.bkjia.com/PHPjc/629889.html techarticle The author has been in the PHP3 environment debugging procedures, and later replaced PhP4, I feel a lot of problems. Mainly some of the original php3 under the normal operation of the program suddenly found in PhP4 a lot of problems ...

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