How to Configure Apache 2.2.21 to Support PHP 5.4.3 and 5.4.31 on Windows

I. Installing Apache — download it from:
http://mirror.cnop.net/web/apache/windows/httpd-2.2.21-win32-x86-no_ssl.msi

ap1.jpg

Click Next
ap2.jpg

Choose “I accept” and click Next

ap3-1.jpg

Fill in your domain and email, then click Next

ap4.jpg

Click Next (you can also choose Custom)

ap5.jpg

Here we install Apache to the root of C: for easier management. You can also keep the default directory. Set your path and click OK

ap6.jpg

Installation complete. Type http://localhost/ in your browser’s address bar to test — you should see “It’s work”

 II.

1. Download PHP 5.4.31
http://mirror.cnop.net/php/windows/php-5.4.31-Win32-VC9-x86.zip
2.
(1)Extract the zip file to d:/php
(2)Copy php.ini-recommended and rename it to php.ini
(3)Modify the following parameters in php.ini

Change
extension_dir = "ext"
to

extension_dir = "d:/php/ext"

Uncomment the following lines by removing the leading semicolons
extension=php_gd2.dll
extension=php_curl.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_zip.dll

        Copy libeay32.dll, libmcrypt.dll, libmhash.dll, libmhash.dll, libpq.dll, php5ts.dll, and ssleay32.dll to C:/windows/system32 (skip any DLL files you don’t have).
(5)Set the PHP environment variable (optional)
Right-click My Computer – Properties – Advanced – Environment Variables, find PATH and append ;d:/php;d:/php/ext to the end

(6)Configure httpd.conf
Add the following lines below #LoadModule vhost_alias_module modules/mod_vhost_alias.so
(Note: Use standard English quotation marks, otherwise you may get “the request……” errors):

LoadModule php5_module d:/php/php5apache2_2.dll
AddType application/x-httpd-php .php .html .htm
PHPIniDir "d:/php"

3. Test
Restart Apache (note: in my personal testing, I needed to reboot the system to avoid repeated errors; just an FYI). After that, create a file named info.php, enter phpinfo(); and save. Then open your browser

and go to
 

http://localhost/info.php. If the PHP configuration info page appears, the setup is successful.

Leave a Comment

Your email address will not be published.