Installing PHP5.4.15 (thread safe) on Apache 2.2.11
Information
none
Operating system used
Windows Vista Home Premium SP 2
Software prerequisites
Apache 2.2.11
Procedure
- Download and unzip php-5.4.15-Win32-VC9-x86.zip (VC9 x86 Thread Safe):
e.g.: c:\tools\php-5.4.15-Win32-thread-safe
- Set System environment variable: PATH:..;c:\tools\php-5.4.15-Win32-thread-safe
Note:
This is optional. Only required if you want to enter php commands in a terminal.
- Copy file c:\tools\php-5.4.15-Win32-thread-safe\php.ini-production
to
c:\WINDOWS\php.ini
- Edit file c:\WINDOWS\php.ini, change the following line:
error_reporting = E_ALL
:
post_max_size = 8M
:
doc_root = C:\mobilefish_web
:
extension_dir = "c:\tools\php-5.4.15-Win32-thread-safe\ext"
:
upload_max_filesize = 2M
:
extension=php_gd2.dll
extension=php_gmp.dll
extension=php_mysql.dll
extension=php_openssl.dll
- Configure Apache by editing C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf:
-
Enable module to allow output from your server to be compressed before being sent to the client over the network:
LoadModule deflate_module modules/mod_deflate.so
-
Enable module to control and modify HTTP request and response headers:
LoadModule headers_module modules/mod_headers.so
-
In this example PHP will be run as a module in Apache and not as a CGI library.
Add the following line after all the LoadModule statements:
LoadModule php5_module "c:/tools/php-5.4.15-Win32-thread-safe/php5apache2_2.dll"
-
Add index.php in the DirectoryIndex directive:
DirectoryIndex index.html index.shtm index.htm index.php
-
Add the following line after all the AddType statements:
AddType application/x-httpd-php .php
View the updated httpd.conf file.
- Restart Apache.
- To test the PHP installation, create a file phpinfo.php with the following line:
<?php phpinfo(); ?>
Save this file into your Apache htdocs directory, e.g.: C:\mobilefish_web and type:
http://localhost/phpinfo.php
You should see something like this:
|