PHP3与PHP4共存实例_PHP
笔者一直都在php3环境下调试程序,后来换成php4后,就觉得问题不少。 主要是一些原来在php3下运行正常的程序忽然发现在php4下出了好多毛病。 而原来在php4下的程序到了php3中又说xx函数没定义或者说某个函数语法不完整什么的。于是忽然想起:可以不可以把两者都装上呢?也好测试程 序对两者的兼容性啊。
笔者参考的php4/3的安装和说明文档中并没有具体说明方法,大概只说 了两者可以通过--enable-versioning指令以及DSO模式达到共存目的。那到底是如何个DSO呢?经过笔者n次反复琢磨安装和配置实践,最终成功将 两者都顺利安装到同一个web服务器内,凡是.php3的文件就由php3解析,而.php文件就由php4解析。
实现的原理:
要实现两个不同版本的解析器共存工作,必须使用enable-versioning 指令,而应该在什么时候使用呢?这个取决于哪个版本的解析器安装在 后面,那么这个指令就只需要在后面安装的时候使用。就是说,如果你 是先装php4(本例中就是这样),后装php3的,那么配置php3的时候就要 添加enable-versioning指令。反过来也是一样道理。
以下是安装配置步骤:
1、考虑到笔者自己的系统中装的是php4,采用的是static模式,因此如果要 采用DSO,那么只能是php3采用了。但是enable-versioning到底是什么时候 加呢?由于文档中并没清楚说明,笔者只能自己测试了。关于安装apache的配置指令这里就不多赘述了。
2、先编译和安装php4,采用静态方式,主要指令如下:
./configure --with-mysql=/www/mysql --with-apache=../apache_1.3.12
\ > --enable-track-vars
3、注意:编译和安装好php4后,要先将apache安装好,否则下一步以DSO模式 安装和编译php3的时候没办法apxs脚本了。并且要注意!!!!的是,配置apache 的时候要加入--enable-shared=max指令(就是使用dso方式)然后再编译并 安装好apache。
4、最后,就配置和编译php3。解压后,运行:
./configure --with-mysql=/www/mysql --with-apxs=/www/httpd/bin/apxs
\ > --enable-versioning
make
make install
一般情况下基本上没问题。 如果读者使用的是php4rc1等比较老的php4的话也许在编译的时候出现不去 编译php4rc1目录的内容而只编译php3目录内容,那么一个解决方法是在编译 好php4后将php4rc1的目录改变名字,这样就没问题了。
测试:一般只要顺利通过编译和安装,那么只需要修改好httpd.conf关于php3和 php4的设置项,然后重新启动apache就可以了。
在htdocs目录下建立两个文件test.php 和test.php3,正常情况下调用test.php会显示php4的内容而调用test.php3则显示php3的内容。 test.php/test.php3内容如下:
phpinfo();

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution to the problem that Win11 system cannot install Chinese language pack With the launch of Windows 11 system, many users began to upgrade their operating system to experience new functions and interfaces. However, some users found that they were unable to install the Chinese language pack after upgrading, which troubled their experience. In this article, we will discuss the reasons why Win11 system cannot install the Chinese language pack and provide some solutions to help users solve this problem. Cause Analysis First, let us analyze the inability of Win11 system to

How to get items using commands in Terraria? 1. What is the command to give items in Terraria? In the Terraria game, giving command to items is a very practical function. Through this command, players can directly obtain the items they need without having to fight monsters or teleport to a certain location. This can greatly save time, improve the efficiency of the game, and allow players to focus more on exploring and building the world. Overall, this feature makes the gaming experience smoother and more enjoyable. 2. How to use Terraria to give item commands 1. Open the game and enter the game interface. 2. Press the "Enter" key on the keyboard to open the chat window. 3. Enter the command format in the chat window: "/give[player name][item ID][item quantity]".

You may not be able to install guest additions to a virtual machine in OracleVirtualBox. When we click on Devices>InstallGuestAdditionsCDImage, it just throws an error as shown below: VirtualBox - Error: Unable to insert virtual disc C: Programming FilesOracleVirtualBoxVBoxGuestAdditions.iso into ubuntu machine In this post we will understand what happens when you What to do when you can't install guest additions in VirtualBox. Unable to install guest additions in VirtualBox If you can't install it in Virtua

If you have successfully downloaded the installation file of Baidu Netdisk, but cannot install it normally, it may be that there is an error in the integrity of the software file or there is a problem with the residual files and registry entries. Let this site take care of it for users. Let’s introduce the analysis of the problem that Baidu Netdisk is successfully downloaded but cannot be installed. Analysis of the problem that Baidu Netdisk downloaded successfully but could not be installed 1. Check the integrity of the installation file: Make sure that the downloaded installation file is complete and not damaged. You can download it again, or try to download the installation file from another trusted source. 2. Turn off anti-virus software and firewall: Some anti-virus software or firewall programs may prevent the installation program from running properly. Try disabling or exiting the anti-virus software and firewall, then re-run the installation

Installing Android applications on Linux has always been a concern for many users. Especially for Linux users who like to use Android applications, it is very important to master how to install Android applications on Linux systems. Although running Android applications directly on Linux is not as simple as on the Android platform, by using emulators or third-party tools, we can still happily enjoy Android applications on Linux. The following will introduce how to install Android applications on Linux systems.

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

While studying in high school, some students take very clear and accurate notes, taking more notes than others in the same class. For some, note-taking is a hobby, while for others, it is a necessity when they easily forget small information about anything important. Microsoft's NTFS application is particularly useful for students who wish to save important notes beyond regular lectures. In this article, we will describe the installation of Ubuntu applications on Ubuntu24. Updating the Ubuntu System Before installing the Ubuntu installer, on Ubuntu24 we need to ensure that the newly configured system has been updated. We can use the most famous "a" in Ubuntu system

If you have used Docker, you must understand daemons, containers, and their functions. A daemon is a service that runs in the background when a container is already in use in any system. Podman is a free management tool for managing and creating containers without relying on any daemon such as Docker. Therefore, it has advantages in managing containers without the need for long-term backend services. Additionally, Podman does not require root-level permissions to be used. This guide discusses in detail how to install Podman on Ubuntu24. To update the system, we first need to update the system and open the Terminal shell of Ubuntu24. During both installation and upgrade processes, we need to use the command line. a simple
