PHP3 and PHP4 coexistence instances

Source: Internet
Author: User
I have been debugging programs in the php3 environment. after I switched to php4, I felt a lot of problems. The main reason is that some programs that run normally under php3 suddenly found that there were a lot of hairs under php4 and I had been debugging programs in the php3 environment. after I switched to php4, I felt a lot of problems. The main reason is that some programs that run normally under php3 suddenly found a lot of problems under php4. In the past, the program in php4 went to php3 and said that the xx function was not defined or a function syntax was incomplete. So I suddenly remembered: Can I install both of them? The compatibility between the test procedure and the test procedure.

The installation and instructions in the php4/3 document I have referenced do not provide specific instructions. I just mentioned that the two can coexist through the -- enable-versioning command and DSO mode. So how exactly is DSO? After over n times of installation and configuration practices, I finally successfully installed both of them on the same web server. php3 files are parsed by php3, and. php files are parsed by php4.

Implementation principle:

To implement the coexistence of two different versions of the parser, you must use the enable-versioning command. When should I use it? This depends on which version of the parser is installed later, so this command only needs to be used during subsequent installation. That is to say, if you first install php4 (in this example) and then install php3, you need to add the enable-versioning command when configuring php3. The opposite is true.

The installation and configuration steps are as follows:

1. considering that php4 is installed in my system and the static mode is used, if DSO is to be used, only php3 is used. But when will enable-versioning be added? As the document does not clearly explain, I can only test it myself. The configuration commands for installing apache are not described here.

2. Compile and install php4 in static mode. The main commands are as follows:

./Configure -- with-mysql =/www/mysql -- with-apache = ../apache_1.3.12

\> -- Enable-track-vars

3. note: after compiling and installing php4, you must install apache first. Otherwise, you cannot install and compile the apxs script in DSO mode. And pay attention to it !!!! When configuring apache, add the -- enable-shared = max command (that is, use the dso method) and then compile and install 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 you are using older php4 files such as php4rc1, you may not compile the contents of the php4rc1 directory while compiling the contents of the php3 directory, A solution is to change the name of the php4rc1 directory after compiling php4.

Test: Generally, you only need to modify the settings of httpd. conf on php3 and php4 and restart apache after compilation and installation.

Create two files "test. php" and "test. php3" under the htdocs Directory. Normally, the "test. php" file is called to display the content of php4, and the "test. php3" file is called to display the content of php3. The content of test. php/test. php3 is 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.