Window 7 and XP installation of Apache 2.4 and PHP 5.4

  • 2020-06-01 09:16:20
  • OfStack

1. Download address
5.4 - Apache httpd - 2.4.4 - win32. zip
5.4 - PHP php 5.4.15 - Win32 - VC9 - x86. zip
Note that the VC9 thread-safe version already includes PHP and Apache connector DLL, so there is no need to download DLL.
2. The configuration
1. Apache
Use any editor opens apache2. 4 / conf/httpd conf start configuration file.
1.1 set the Apache location

ServerRoot "D:/Program Files/apache2.4"

1.2 enable the used module
I only removed the comments for the mod_rewrite module.
1.3 add the following content under the module content

LoadModule php5_module "D:/Program Files/PHP5.4 , php5apache2_4.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
AddHandler application/x-httpd-php .php
PHPIniDir "D:/Program Files/PHP5.4"

1.4 modify the server administrator's email address

ServerAdmin info@yoursite.com

1.5 modify the document root directory

DocumentRoot "E:/www"
<Directory "E:/www">

1.6 find 1 to replace the actual path

ScriptAlias /cgi-bin/ "D:/Program Files/apache2.4/cgi-bin/"
<Directory "D:/Program Files/apache2.4/cgi-bin">

1.7 please modify if you want to enable.htaccess < Directory "D: / www" > The content of

AllowOverride All

1.8 add index.php to the index directory

DirectoryIndex index.html index.php

2. PHP
1.1 rename php.ini-development to php.ini
1.2 modify the extension path

extension_dir = "D:/Program Files/PHP5.4/ext"

1.3 uncomment the following line

extension=php_curl.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
extension=php_soap.dll

1.4 if you use PHP's email function, please modify the following

SMTP = smtp.yoursite.com
smtp_port = 25
sendmail_from = youremail@sender.com

1.5 finally set the next time zone

LoadModule php5_module "D:/Program Files/PHP5.4 , php5apache2_4.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
AddHandler application/x-httpd-php .php
PHPIniDir "D:/Program Files/PHP5.4"
0
3. The installation
You need to install the Apache 2.4 service into the system service, go - > Run, enter cmd, and then enter:

cd D:/Program Files/apache2.4/bin
httpd.exe -k install -n "Apache24"

Compile one index.php file with the content as < ?php phpinfo() ? > , start the apache service and visit the following http://localhost/

Related articles: