Thursday, May 11, 2006

INSTALL: PHP5+APACHE2+WIN32

Installing php 5, apache 2 in a win32 environment is easy. Sometimes enabling extensions can be difficult, but we will be enabling php_curl.dll, php_mysql.dll, php_mcrypt.dll, and php_mssql.dll.

Download PHP5 zip package
(the .zip with all the extensions, not the .exe installer)
Download Apache2 from http://http.apache.org
(link to 2.2.2 /w no SSL)
Unzip PHP5 to C:\PHP
Run the apache2 installer

if you have a folder named C:\PHP\extensions rename it to C:\PHP\ext
rename C:\PHP\php.ini-recommmended to C:\PHP\php.ini
edit C:\PHP\php.ini,
change the extension_dir to "C:\php\ext" (include quotation marks)
remove the ; from line: ;extension=php_curl.dll
remove the ; from line: ;extension=php_mysql.dll
remove the ; from line: ;extension=php_mcrypt.dll
remove the ; from line: ;extension=php_mssql.dll

edit http.conf, add the following lines to the bottom (default location-
c:\program files\apache group\apache2\conf\http.conf)
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-http-php .php
# configure the path to php.ini
PHPIniDir "C:\php"

Now, right-click on "My Computer", go to "Properties", go to the "Advanced" tab, click on the "Environment Variables" button. Under "System" add ";C:\php;C:\php\ext" to your PATH variable.

create a file called
c:\program files\apache group\apache2\htdocs\phpinfo.php
containing the text
<?php phpinfo(); ?>


When you reboot next, your PATH settings will be available to all programs, your apache2 will load as a service, it will see the new version of the http.conf file with the modifications you made, and will see the new php.ini file with the modifications you made, and when you hit "http://localhost/phpinfo.php" you will see an html version of your php.ini file with all of the settings, and you will see sections for each of the php extensions you have enabled.

No comments: