Home Backend Development PHP Tutorial PHP4 and PHP5 coexist in one system_PHP tutorial

PHP4 and PHP5 coexist in one system_PHP tutorial

Jul 21, 2016 pm 04:01 PM
php5 one and exist place of system

PHP4和PHP5共存于一系统

在其它地方看到的一篇文章,老了一点,这两天也正想找个时间来用IIS+APACHE使用不同端口来做两个PHP共存....到时再发出来'罢..看原文吧

-------------------------------------------------------------
好处不多说了,:D 坏处嘛...是CGI方式的(引用官方原文:we consider installing PHP like this suicidal.--esayr注:E文不好?呵,最后一个是自杀的意思)
废话少说,直接看方法:

一,本文涉及软件极其版本:
Windows 2000 Professional/XP
Apache 1.3.28 FOR WIN
Microsoft Internet Server Information(IIS6)
PHP 4.3.3(4.3.5), PHP 5.0.0 beta(5.0.0RC1)
MySQL 3.23.57(3.23.58)


二,大致步骤:(二,三任选)

1.分别安装各版本的PHP

2.安装APACHE,设置APACHE 和 PHP

3.安装IIS,并在IIS中设置PHP各版本[注1]

4.安装MYSQL


三,安装前准备:
将所须程序COPY至各文件夹,本文按照以下目录结构进行,你可以根据需要自行修改^^:


C:/httpd/Apache
C:/httpd/MySQL
C:/httpd/PHP4
C:/httpd/PHP5
C:/httpd/php-includes
C:/httpd/phpMyAdmin
C:/httpd/tmp
C:/httpd/www

到C:/WINNT/system32/drivers/etc(XP是C:/WINDOWS/system32/drivers/etc)文件夹下,找到hosts文件(没有?! @_@ 那么.... :D ),在底下增加

127.0.0.1 php4 # Waiter PHP 4
127.0.0.1 php5 # Waiter PHP 5


吼吼...如果你懂~~自己修改其他名字吧 8D 我们继续...
保存文件...


四,安装各版本PHP
假设你已经下载你需要的各版本PHP...(哪下载?? :P 自己找吧...)
这里以4.3.3和5.0.0-beta为例...(4.3.5vs5.0.0RC1我也试了.如果和你环境不一样不要怪我 :( ,大同小异,自己琢磨吧) ;)

㈠安装PHP4.3.3
①解压缩下载文件(:) 地球人都知道)
②将PHP4.3.3中的php.exe, php.ini-recommended, phpêmbed.lib, php4ts.dll, php4ts.lib, dll/*.* 和 extensions/*.* 拷贝到C:/httpd/PHP4
③修改php.ini-recommended:
extension_dir = "C:/httpd/PHP4/extensions/"
cgi.force_redirect = 0
保存为php.ini(就在C:/httpd/PHP4/下)

㈡安装PHP5.0.0BETA
①解压缩...
②将php.exe, php.ini-recommended, phpêmbed.lib, php4ts.dll, php4ts.lib, dll/*.* 和 extensions/*.*拷贝至C:httpdPHP5
如果是PHP5.0.0RC1,那么没有dll和extensions目录,只有ext--就是extensions拉
如果...你是mysql的忠实用户,别忘了把libmysql.dll也拷过去[注2].
③修改php.ini-recommended:
extension_dir = "C:/httpd/PHP5/extensions/"
cgi.force_redirect = 0
如果是PHP4.0.0RC1,那么extension_dir = "C:/httpd/PHP5/ext/"
保存为php.ini(就在C:/httpd/PHP5/下)


五,配置APACHE
打开C:/httpd/Apache/conf/httpd.conf,在底下追加一些设置:


ServerAdmin test@php433
ServerName php4
ServerAlias www
DocumentRoot "C:/httpd/www"

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

ScriptAlias /php4/ "C:/httpd/php4/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php4/php.exe"



ServerAdmin test@php500
ServerName php5
DocumentRoot "C:/httpd/www"

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

ScriptAlias /php5/ "C:/httpd/php5/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php5/php-cgi.exe"

六,关于PHP5和MYSQL
MYSQL的安装,我就不多说了,自己下了装吧...(跳过这段没意见吧? )
你可以通过修改php.ini,来加载MYSQL... (难过...)

七,测试...
启动APACHE(如果httpd.conf配置有错,会有出错提示...),然后地址栏输入http://php4和http://php5就分别启动PHP4和PHP5咯...爽吗? :D :D :D [注3]
相信对广大PHP程序员,以及想学PHP5又不想放弃PHP4的同志来说,这会是个不错的方法.ENJOY IT!

总结一下:
其实思路很简单,利用CGI方式实现PHP4和PHP5的共存.我找了很多资料,这个算最简单最实用了.不过只适合大家本机玩,千万别在服务器上这么搞...否则~后果自负...别找我

如果你按上面方法有问题,可以尝试其他途径,这里罗列一些国外的成功案例:
http://wiki.coggeshall.org/37.html
http://www.circle.ch/blog/p1387.html
http://www.schlitt.info/applications/blog/..._5_prallel.html

有兴趣的可以继续学习下...


继续关于本方案的一点重要补充:

PHP4和PHP5共存,存在一个php.ini冲突的问题...
大家都知道,一般做法是需要将php.ini复制到系统文件夹下(C:WinNT or C:Windows).如果同时安装多版本,势必会造成冲突...

其实,如果大家仔细阅读PHP安装文档,会有如下一段文字:
Does Where C I cut to could the php.ini? The php.ini files is only searched in two places: 1) in your Apache installation directory (e.g. c:apacheapache) 2) in your %SYSTEMROOT% directory.

而我们正是使用的第一种方式...(是不是官方早料到有这种情况??GOD KNOWS...)

我在上述环境下测试成功了...如果你遇到困难可以留言或到讨论区一起讨论。

结语:
偶不太会写教程之类的东东...自己看了懂,却不是很容易让别人理解,大家只好忍让了.
虽然过程比较简单,不过费了我不少时间(有两个地方...我找的资料有误,把我害惨了),这个大A作证拉...( :D 大A睡了一觉起来上厕所,我还在...此处少儿不宜,删去500字)

PHP5时代越来越近,赶紧深入了解去吧...

-------------------------------------------------------------------------
[注1]:
本来想写FOR IIS的...可实在不想在自己机器上装个没用的东西(对我而言 :( ),so...标题列了,却放弃写了...对部分看客说声抱歉...

[注2]:
这里说点题外话:在PHP5.0.0RC1中,不知道大家看到ext下有个mysqli.dll,以及php.exe同层目录下有个libmysqli.dll么?奇怪这是干嘛的?其实这是官方针对MYSQL的新版(4.1.0好象是...吧)的一个升级,对于高版本MYSQL玩家可以试试...据说支持MYSQL一些新特性哦

[注3]:
在启动APACHE时,如果看到什么"overlap on port 80"...不要着急,在httpd.conf中,把NameVirtualHost *:80前的注释去了即可...(这个地方难了我好长时间...只怪APACHE设置不熟悉.不过这次算好好把APACHE的设置看了遍,还是有收获)


相关文章
• apache 2.2.2 + PHP5.1.4 不能运行的解决办法. - 05-11 02:07 pm - 点击: 12651
• PHP5.1.3发布 - 05-03 09:41 pm - 点击: 1860
• PHP5学习笔记 -- Classes and Objects in PHP5 - 09-05 02:13 pm - 点击: 5776
• 从PHP4.3.*升级到PHP5.0.0 - 08-09 01:49 am - 点击: 5136
• php4和php5的配置异同比较 - 08-01 06:25 pm - 点击: 4260
• redhat 9下配置APACHE2.0.50 +PHP5+MYSQL4.0.20+GD库 - 07-29 02:00 am - 点击: 13784
• php5 for windows 安装详解 - 07-14 10:33 pm - 点击: 13370
• PHP5正式版昨日发行--附PHP研究手册 - 07-14 10:04 pm - 点击: 6069
• 为面向对象而生的PHP5 之二 - 06-25 07:13 pm - 点击: 3749
• 为面向对象而生的PHP5 (1) - 06-25 07:11 pm - 点击: 4488

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316906.htmlTechArticlePHP4 and PHP5 coexist in one system. An article I saw elsewhere, a little old, these two days I am also trying to find a time to use IIS+APACHE to use different ports to make two PHPs coexist....I will send it out then...
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

CUDA's universal matrix multiplication: from entry to proficiency! CUDA's universal matrix multiplication: from entry to proficiency! Mar 25, 2024 pm 12:30 PM

General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Jun 02, 2024 pm 02:58 PM

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

Digital audio output interface on the motherboard-SPDIF OUT Digital audio output interface on the motherboard-SPDIF OUT Jan 14, 2024 pm 04:42 PM

SPDIFOUT connection line sequence on the motherboard. Recently, I encountered a problem regarding the wiring sequence of the wires. I checked online. Some information says that 1, 2, and 4 correspond to out, +5V, and ground; while other information says that 1, 2, and 4 correspond to out, ground, and +5V. The best way is to check your motherboard manual. If you can't find the manual, you can use a multimeter to measure it. Find the ground first, then you can determine the order of the rest of the wiring. How to connect motherboard VDG wiring When connecting the VDG wiring of the motherboard, you need to plug one end of the VGA cable into the VGA interface of the monitor and the other end into the VGA interface of the computer's graphics card. Please be careful not to plug it into the motherboard's VGA port. Once connected, you can

Which version of Apple 16 system is the best? Which version of Apple 16 system is the best? Mar 08, 2024 pm 05:16 PM

The best version of the Apple 16 system is iOS16.1.4. The best version of the iOS16 system may vary from person to person. The additions and improvements in daily use experience have also been praised by many users. Which version of the Apple 16 system is the best? Answer: iOS16.1.4 The best version of the iOS 16 system may vary from person to person. According to public information, iOS16, launched in 2022, is considered a very stable and performant version, and users are quite satisfied with its overall experience. In addition, the addition of new features and improvements in daily use experience in iOS16 have also been well received by many users. Especially in terms of updated battery life, signal performance and heating control, user feedback has been relatively positive. However, considering iPhone14

What are the computer operating systems? What are the computer operating systems? Jan 12, 2024 pm 03:12 PM

A computer operating system is a system used to manage computer hardware and software programs. It is also an operating system program developed based on all software systems. Different operating systems have different users. So what are the computer systems? Below, the editor will share with you what computer operating systems are. The so-called operating system is to manage computer hardware and software programs. All software is developed based on operating system programs. In fact, there are many types of operating systems, including those for industrial use, commercial use, and personal use, covering a wide range of applications. Below, the editor will explain to you what computer operating systems are. What computer operating systems are Windows systems? The Windows system is an operating system developed by Microsoft Corporation of the United States. than the most

Detailed explanation of how to modify system date in Oracle database Detailed explanation of how to modify system date in Oracle database Mar 09, 2024 am 10:21 AM

Detailed explanation of the method of modifying the system date in the Oracle database. In the Oracle database, the method of modifying the system date mainly involves modifying the NLS_DATE_FORMAT parameter and using the SYSDATE function. This article will introduce these two methods and their specific code examples in detail to help readers better understand and master the operation of modifying the system date in the Oracle database. 1. Modify NLS_DATE_FORMAT parameter method NLS_DATE_FORMAT is Oracle data

Differences and similarities of cmd commands in Linux and Windows systems Differences and similarities of cmd commands in Linux and Windows systems Mar 15, 2024 am 08:12 AM

Linux and Windows are two common operating systems, representing the open source Linux system and the commercial Windows system respectively. In both operating systems, there is a command line interface for users to interact with the operating system. In Linux systems, users use the Shell command line, while in Windows systems, users use the cmd command line. The Shell command line in Linux system is a very powerful tool that can complete almost all system management tasks.

See all articles