Note: Part of this article is translated in English and part is original. You need to pay attention to it. References: http://www.devraju.com/php/installing-php-5-4-with-apache-2-4-in-32-bit-of-windows/
In the past, XAMPP was directly installed, which is very convenient. For Windows 7, Windows XP, and Linux, many configurations are configured by default. But I tried to do it myself.
First, the latest version of PHP does not provide vc6 (compiled by Visual C ++ 2006), but only vc9 (compiled by Visual C ++ 2008 or later) version, because vc9 performance has improved a lot, I use php5.4.7 thread security version, the latest version.
However, when using PHP compiled by vc9, you must use Apache compiled by vc9, but it is not provided on the Apache official website (apache.org, we need to download the latest version of Apache compiled by vc9 from the website www.apachelounge.com. This article uses apache2.43. Enter the subject below:
To run the program compiled by vc9 or VC10, you need to install the Visual C ++ redistributable package. You can download it from the official website (it seems that version 08 must be installed here, I am not clear about the specific reason. If you have installed Visual Studio, you do not need to install it)
- Visual c ++ 2008-http://www.microsoft.com/download/en/details.aspx? Id = 5582
- Visual c ++ 2010-http://www.microsoft.com/download/en/details.aspx? Id = 8328
Download
1. Download Apache http://www.apachelounge.com/download/
2. download the DLL http://www.apachelounge.com/download/ for connecting Apache and PHP (these two download from the same website, not the Apache official website, note that I use PHP version 5.4, so the DLL connecting Apache and PHP must also be in version 5.4)
3. Download the thread security version of the PHP http://windows.php.net/download/ (Be sure to download the thread security version, or it may be a problem)
Install
1. decompress the downloaded apache(httpd-2.4.3-win32.zip) to the d:/webroot/Apache24 directory.
2. decompress the downloaded PHP (php-5.4.7-Win32-VC9-x86.zip) to the d:/webroot/PHP Directory.
3. Copy the dll connected to PHP and apache to the d:/webroot/PHP Directory (Be sure to select the correct dll version php5.4.7)
Configure Apache
1. Use notepad ++ to open httpd. conf in d:/webroot/Apache24/conf:
Set the apache root directory: ServerRoot "D:/webroot/apache24"
Set administrator mailbox: ServerAdmin admin@localhost.com
Domain Name configuration: ServerName localhost: 80
2. Modify permissions for all folders
<Directory/>
AllowOverride none
# Require all denied
Order deny, allow
Deny from all
</Directory>
3. Configure the root directory
DocumentRoot "D:/webroot/Apache24/htdocs"
4. configure root directory permissions
<Directory "D:/webroot/Apache24/htdocs">
Options Indexes FollowSymLinks
AllowOverride all
Order allow, deny
Allow from all
</Directory>
5. Configure the welcome page, Home Page
<IfModule dir_module>
# Direcoprocessor is equivalent to the welcome page
DirectoryIndex news.html index.html index.htm index. php
</IfModule>
6. Load the php module:
LoadModule php5_module "D:/webroot/PHP/php5apache2_4.dll"
AddHandler application/x-httpd-php. php
# Specify the location of php. ini (Note: You need to rename php. ini-development to php. ini)
<IfModule php5_module>
PHPIniDir "D:/webroot/PHP"
</IfModule>
Configure PHP
1. Use notepad ++ to open PHP. ini in D:/webroot/PHP and modify the content.
Extension_dir = "D:/webroot/PHP/EXT"
2. Open the module used to connect to the MySQL database
Extension = php_mysql.dll
Extension = php_mysqli.dll
So far, Apache and PHP have been installed successfully. Open the DOS window, enter the Directory D:/webroot/Apache/bin, enter httpd.exe-K install, and install the service in windows, in this way, you can see the apache service (running → services. MSC ).
Start Apache: httpd.exe-K start, or start it in services. MSC. We recommend that you start Apache in the DOS window because an error message is prompted. For example, if I didn't select the correct DLL for connecting Apache to PhP, the prompt "can not load php5apache2_4.dll" will be displayed.
Cainiao. You are welcome to join us.