Menu
InformatiWeb
  • Index
  • Courses
  • Tutorials
  • InformatiWeb Pro

Login

Registration Password lost ?
FR
  • IT
    • Articles
    • Backup
    • BIOS
    • Live CD
    • MultiBoot
    • Security
    • Virtualization
    • Web
    • Windows
  • InformatiWeb
  • Tutorials
  • IT
  • Web
  • Simultaneous installation of PHP 4 and 5 on a Windows server
  • Web
  • Web servers
  • 17 September 2010 at 17:10 UTC
  • Lionel
  • 1/2

Simultaneous installation of PHP 4 and 5 on a Windows server

Here is an installation under Win32 (Windows 32 bit) which allows to easily test a script in PHP 4 and PHP 5.

The facility includes two instances of Apache :

PHP 5 on the port 80
PHP 4 on the port 81

The installation also includes consideration of MySQL.
Note : If you want, you can reverse the two ports but don't forget to change each place where it is needed and well attetion to stop services (apache2-php4 and apache2-php5) before)

This procedure has been tested under Win XP but Apache also runs on Windows Seven. Warning this installation is at your own risk.

If you have already installed a Web server before (Whether Apache, WAMP, Easy PHP, Weezo ...), uninstall it first. Otherwise, it will not work.

Warning : Windows 7 (Seven) should be followed to facilities under the "TRUE" Administrator Account (also called "Super Administrator")

  1. Objective of this installation : Easily Test scripts in PHP 4 and PHP 5
  2. Download Notepad + + (to edit the config. files)
  3. Creation of 2 Apache instances v.2.0.52
  4. Installing PHP 5
  5. Installing PHP 4
  6. Installing MySQL 4.02d

1. Objective of this installation : Easily Test scripts in PHP 4 and PHP 5

Create two instances of Apache :
- one for PHP 5 (port : 80)
- one for PHP 4 (port : 81)

Why 2 instances ?

  • Sharing problem php.ini:
    It is possible to create 2 php.ini files for PHP 5 and PHP 4, place each php.ini file in the root php distribution (ex : c:\server\php5), and specify the path in httpd.conf : PHPIniDir "c:/server/php5".
  • Problem of possible sharing of DLL :
    DLL can be searched in c:\WINNT;c:\WINNT\system32;PATH;current directory, ... It's possible to create two instances of Apache in order to place the DLL of each PHP distribution in the folder of its respective Apache instance rather than in SYSTEM32.

Organization of directories :

  • c:\mysql
  • c:\server\apache2-php4
  • c:\server\php4
  • c:\server\apache2-php5
  • c:\server\php5
  • c:\server\doc : Répertoire pour les documentations php, mysql...
  • c:\server\phpmyadmin : Répertoire phpmyadmin
  • c:\server\www : Répertoire de publication

2. Download Notepad + + (to edit the config. files)

  • Download Notepad ++ and install it.
  • This free software has the particularity to display line numbers. this is why I said the line numbers where the lines change in configs files

3. Creation of 2 Apache instances v.2.0.52

  • Télécharger la version Binaire avec OpenSSL. Download the binary version with OpenSSL.
  • File : Apache_2.0.52-Openssl_0.9.7e-Win32.zip
  • Unzip this archive
  • Create two directories :
    - c:\server\apache2-php4
    - c:\server\apache2-php5
  • Unzip the downloaded file in the 2 previous directories
  • Create the httpd.conf file.
  • Create a publishing directory : c:\server\www
  • Create a Test Page : c:\server\www en .htm
  • Create a phpinfo() test page : c:\server\www\phpinfo.php with this content : <?php phpinfo() ON DUPLICATE KEY UPDATE texte_us = VALUES(texte_us), tags_description_us = VALUES(tags_description_us), tags_keywords_us = VALUES(tags_keywords_us), num_us = VALUES(num_us), traduit_us = VALUES(traduit_us); ?>
  • Duplicate c:\server\apache2-php4\conf\httpd.conf en httpd-php4.conf
  • Duplicate c:\server\apache2-php5\conf\httpd.conf en httpd-php5.conf
  • Edit httpd-php4.conf
  • Search c:/apache and replace all correspondences by c:/server/apache2-php4
  • 57 ServerRoot "c:/server/apache2-php4"
  • 229 DocumentRoot "c:/server/www"
  • 120 Listen 81
  • 213 ServerName localhost:81
  • Edit httpd-php5.conf
  • Search c:/apache and replace all correspondences by c:/server/apache2-php5
  • 57 ServerRoot "c:/server/apache2-php5"
  • 229 DocumentRoot "c:/server/www"
  • Install Apache 2 as instances Services:
    For this, create a batch file named :
    "installer apache2-php4.bat" and copy this line in this file
    apache -k install -n "apache2-php4" -f "C:\server\apache2-php4\conf\httpd-php4.conf"
  • then the same for the second (PHP 5)
    create a batch file named :
    "installer apache2-php5.bat"
    and copy this line in this file
    apache -k install -n "apache2-php5" -f "C:\server\apache2-php5\conf\httpd-php5.conf"
  • IMPORTANT : Place Services in Manual Start (Control Panel -> Administrative Tools -> Services)
    Under seven, open the start menu and type "Services" and click on "View Local Services"
  • Start or stop Apache in console mode (Ms-Dos) with a batch file (Under account "TRUE Administrator" seven) or simply use ApacheMonitor.exe (c:\server\apache2-php4\ApacheMonitor.exe)
  • Start Services (Copy these 2 lines in a file named "Start Apache.bat")
    NET START "apache2-php4"
    NET START "apache2-php5"
  • Stop Services (Copy these 2 lines in a file named "Stop Apache.bat")
    NET STOP "apache2-php4"
    NET STOP "apache2-php5"
  • Restart services (Copy these 4 lines in a file named "Restart servers.bat")
    @echo off
    echo Stop Servers in progress ...
    NET STOP "apache2-php4"
    NET STOP "apache2-php5"
    NET STOP "MySql"
    echo Start Servers in progress ...
    NET START "apache2-php4"
    NET START "apache2-php5"
    NET START "MySql"
Next page

Share this tutorial

Partager
Tweet

To see also

  • Create VirtualHost accessible from the local area network

    Web 12/17/2011

    Create VirtualHost accessible from the local area network

  • WAMP - Install a complete web server with WAMP 2.0

    Web 1/11/2011

    WAMP - Install a complete web server with WAMP 2.0

  • WAMP - Installing WAMP 2.2, 2.4 or 2.5 and its add-ons

    Web 3/2/2013

    WAMP - Installing WAMP 2.2, 2.4 or 2.5 and its add-ons

Comments

You must be logged in to post a comment

Share your opinion

Pinned content

  • Useful softwares
  • Our programs
  • Terms and conditions
  • Share your opinion

InformatiWeb Pro

  • Win. Server administration
  • Linux Administration
  • Virtualization

Contact

  • Guest book
  • Technical support
  • Contact

® InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.

Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.