Home php教程 php手册 PHP3与PHP4共存实例

PHP3与PHP4共存实例

Jun 13, 2016 am 10:10 AM
Down and back Example Replace with environment program debug

笔者一直都在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();


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Detailed explanation of C++ function debugging: How to debug problems in multi-threaded functions? Detailed explanation of C++ function debugging: How to debug problems in multi-threaded functions? May 02, 2024 pm 04:15 PM

C++ multi-thread debugging can use GDB: 1. Enable debugging information compilation; 2. Set breakpoints; 3. Use infothreads to view threads; 4. Use thread to switch threads; 5. Use next, stepi, and locals to debug. Actual case debugging deadlock: 1. Use threadapplyallbt to print the stack; 2. Check the thread status; 3. Single-step the main thread; 4. Use condition variables to coordinate access to solve the deadlock.

Clock app missing in iPhone: How to fix it Clock app missing in iPhone: How to fix it May 03, 2024 pm 09:19 PM

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and

How to use LeakSanitizer to debug C++ memory leaks? How to use LeakSanitizer to debug C++ memory leaks? Jun 02, 2024 pm 09:46 PM

How to use LeakSanitizer to debug C++ memory leaks? Install LeakSanitizer. Enable LeakSanitizer via compile flag. Run the application and analyze the LeakSanitizer report. Identify memory allocation types and allocation locations. Fix memory leaks and ensure all dynamically allocated memory is released.

Shortcut to golang function debugging and analysis Shortcut to golang function debugging and analysis May 06, 2024 pm 10:42 PM

This article introduces shortcuts for Go function debugging and analysis, including: built-in debugger dlv, which is used to pause execution, check variables, and set breakpoints. Logging, use the log package to record messages and view them during debugging. The performance analysis tool pprof generates call graphs and analyzes performance, and uses gotoolpprof to analyze data. Practical case: Analyze memory leaks through pprof and generate a call graph to display the functions that cause leaks.

How to do efficient debugging in Java lambda expressions? How to do efficient debugging in Java lambda expressions? Apr 24, 2024 pm 12:03 PM

Efficiently debug Lambda expressions: IntelliJ IDEA Debugger: Set breakpoints on variable declarations or methods, inspect internal variables and state, and see the actual implementation class. Java9+JVMTI: Connect to the runtime JVM to obtain identifiers, inspect bytecode, set breakpoints, and monitor variables and status during execution.

How to conduct concurrency testing and debugging in Java concurrent programming? How to conduct concurrency testing and debugging in Java concurrent programming? May 09, 2024 am 09:33 AM

Concurrency testing and debugging Concurrency testing and debugging in Java concurrent programming are crucial and the following techniques are available: Concurrency testing: Unit testing: Isolate and test a single concurrent task. Integration testing: testing the interaction between multiple concurrent tasks. Load testing: Evaluate an application's performance and scalability under heavy load. Concurrency Debugging: Breakpoints: Pause thread execution and inspect variables or execute code. Logging: Record thread events and status. Stack trace: Identify the source of the exception. Visualization tools: Monitor thread activity and resource usage.

How to debug PHP asynchronous code How to debug PHP asynchronous code May 31, 2024 am 09:08 AM

Tools for debugging PHP asynchronous code include: Psalm: a static analysis tool that can find potential errors. ParallelLint: A tool that inspects asynchronous code and provides recommendations. Xdebug: An extension for debugging PHP applications by enabling a session and stepping through the code. Other tips include using logging, assertions, running code locally, and writing unit tests.

What are the debugging techniques for recursive calls in Java functions? What are the debugging techniques for recursive calls in Java functions? May 05, 2024 am 10:48 AM

The following techniques are available for debugging recursive functions: Check the stack traceSet debug pointsCheck if the base case is implemented correctlyCount the number of recursive callsVisualize the recursive stack

See all articles