Not so long ago there was a need to simultaneously run Apache with support for php4, php5 and mysql. I know that there are several ready-made solutions, but after all they have to be filed with pens for their own needs, so it was decided to assemble such a kit by hand.
Distributions
The following software distributions were used:
Apache: 2.2.9PHP4: 4.4.9PHP5: 5.2.6MySQL: 5.0.67All distributions were downloaded in .zip archives in order to avoid unnecessary registrations in the system. The distribution kit becomes attached to a specific drive and folder (that is, if you initially do everything in the C: \ WebServer folder, then on other computers where you will install it, you will also need to use this folder).
')
File allocation
First, unpack all distributions.
- Apache: C: \ WebServer \ apache
- php4: C: \ Webserver \ php \ php4
- php5: C: \ WebServer \ php \ php5
- mysql: C: \ WebServer \ mysql
the common directory for * php files will be C: \ WebServer \ www
Apache setup
PHP4 and PHP5 will hang on different ports. Let it be 80 (for php5) and 81 (for php4). To do this, make 2 configuration files for Apache and make a trace in them. changes:
httpd-php4.conf:
ServerRoot "C:/WebServer/apache"
Listen 81
LoadFile "c:\WebServer\php\php4\php4ts.dll"
DocumentRoot "C:\WebServer\www\htdocs
<Directory "C:\WebServer\www\htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
<IfModule dir_module>
DirectoryIndex index.html index.php index.htm
Etc. depending on what exactly we need from Apache.
The file php4ts.dll must be placed in the folder php \ php4 \. You can download it here:
www.dll-files.ru/dll/p/Php4ts.dll.htmlNext, do the php5 configuration, httpd-php5.conf file:
ServerRoot "C:/WebServer/apache"
Listen 80
LoadModule php5_module "c:/WebServer/php/php5/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/WebServer/php/php5"
DocumentRoot "C:\WebServer\www\htdocs
<Directory "C:\WebServer\www\htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
<IfModule dir_module>
DirectoryIndex index.html index.php index.htm
We put MySQL:
No special settings are needed, unless you specify the port and password in the my.cnf file. So we will skip this, but we will describe the integration with php:
PHP4, PHP5 setup
Php file \ php4 \ php.ini
engine = On
extension=php_mysql
The remaining extensions are optional. Similarly, we connect php_mysql to php \ php5 \ php.ini
Startup files
Create a folder bin \ for startup files
create an apache-php4.cmd file in it with the contents:
@echo OFF
echo Apache + PHP4 started
C:\WebServer\apache\bin\httpd.exe -f C:\WebServer\apache\conf\httpd-php4.conf &
and the apache-php5.cmd file:
@echo OFF
echo Apache + PHP4 started
C:\WebServer\apache\bin\httpd.exe -f C:\WebServer\apache\conf\httpd-php4.conf &
Now, using these two files, we can run Apache with different versions of PHP. Mysql is started by mysql / bin / mysqld-nt.exe
If the article seems useful to someone, next I will tell you how to make it possible to run them as services.