Installing PHP
Overview
Installing Apache
Installing PHP
Installing MySQL
Other stuff
Copyright / Misc.
First things first:
This tutorial will show you how to install Apache2 with PHP5 and MySQL in the intention to use it for DEVELOPEMENT!
We will need Apache, PHP and MySQL.
Apache's newest version for Windows is 2.0.58(recommended) and 2.2.2 Download (Download the .msi install package)
PHP's newest version is 5.1.4 Download (Download the zip package & the PECL modules collection)
MySQL's newest version is 5.0.22 Download (Download the one described as "Windows (x86)")
[TOP]
The .msc installer makes this easy. Run the installer:

Next...

Agree...

If the fields weren't filled-in automatically filled-in you'll have to fill them in yourself.
The option "for All Users..." should be selected

Next...

Click on Change...

I've set my path to C:\Server ... feel free to set it to whatever you like
I might add that the install always creates a folder called "Apache2" so you don't need to add a "apache" folder.
If you do you'll end up with a path like "C:\Server\Apache\Apache2".
NOTE: The problem with the path has been fixed in Apache 2.2.2. Install it in C:\Server\Apache2!

Install...

Wait a bit.

Done!
Ok now we'll check if if you'd done it right. A handy tool should have been installed with the server. It's a feather-like icon on the task bar. Right-click and select "Open Apache Monitor".

If the icon next to "Apache2" is green then apache should be running.
Now visit http://localhost/ (or http://127.0.0.1/).
You should see somethikng like this:

It works!
Ok now we'll change a few settings to move the folder in which the web files are stored - the Document Root. (this part is optional but it makes it make things easier).
- Find:
DocumentRoot "C:/Server/Apache2/htdocs"
and change it to
DocumentRoot "C:/Server/htdocs"
- Find:
<Directory "C:/Server/Apache2/htdocs">
and change it to whatever you changed the line above to
<Directory "C:/Server/htdocs">
You have to make sure thet the folder you specified exists and restart apache. Just open thae Apache Monitor and click on "Restart".
[TOP]
Just Go to Control Panel -> Add or Remove Programs, find Apache and uninstall it. I recommend you to re-do the httpd.conf editing.
Delete your old Apache folder.
Follow the Apache installation guide to install the new version.
If you had PHP installed you'll have to copy some files to your Apache directory, as described in the PHP installation guide.
If you have decided to use Apache2.2.2 you'll have to take the additional Apache2.2.x PHP installation step.
This part of the tutorial assumes you have Apache2 already installed.
After downloading the two zip files extract the first on (the one WITHOUT "pecl" in it's name) to C:\Server\ (You can choose wahtever folder you like but it's a good idea to have it all in one place.

After extracting it and rename the folder to "php".
Now Extract the second .zip file to C:\Server\php\ext\. Just copy everything.

Go back to C:\Server\php and rename the file "php.ini-dist" to "php.ini"
Edit the php.ini:
- Find:
error_reporting = E_ALL & ~E_NOTICE
and change it to
error_reporting = E_ALL
- Find:
display_startup_errors = Off
and change it to
display_startup_errors = On
- (optional; See Manual) Find:
track_errors = Off
and change it to
track_errors = On
- Find:
;arg_separator.output = "&"
and change it to
arg_separator.output = "&"
- Find:
register_long_arrays = On
and change it to
register_long_arrays = Off
- (improtant) Magic Quotes are very annoying
Find:
magic_quotes_gpc = On
and change it to
magic_quotes_gpc = Off
- (improtant) Extensions (this is needed if you want to use a database... or gd)
Find:
extension_dir = "./"
and change it to
extension_dir = "C:\Server\php\ext"
It should point to the ext folder. If you've extracted php to another directory the path should be different.
- Find:
;extension=php_mbstring.dll
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
and change it to one of these:
-
Reasonable - This is something you may find on a PHP5.1 host.
;extension=php_apc.dll
;extension=php_apd.dll
;extension=php_bcompiler.dll
;extension=php_big_int.dll ; Not an official extension. Replaced by gmp.
;extension=php_bitset.dll
;extension=php_blenc.dll
extension=php_bz2.dll
extension=php_bz2_filter.dll
;extension=php_classkit.dll ; Replaced by runkit
;extension=php_cpdf.dll
;extension=php_crack.dll
extension=php_curl.dll
;extension=php_cvsclient.dll
;extension=php_db.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_dio.dll
;extension=php_docblock.dll
extension=php_domxml.dll
;extension=php_event.dll
extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_fileinfo.dll
;extension=php_filepro.dll
;extension=php_filter.dll
;extension=php_fribidi.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
;extension=php_gopher.dll
extension=php_hash.dll
;extension=php_http.dll
;extension=php_hyperwave.dll
;extension=php_ibm_db2.dll
extension=php_id3.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imagick.dll
extension=php_imap.dll
;extension=php_ingres.dll
;extension=php_interbase.dll
extension=php_java.dll
extension=php_json.dll
extension=php_ldap.dll
;extension=php_lzf.dll
;extension=php_mailparse.dll
extension=php_mcrypt.dll
extension=php_mcrypt_filter.dll
extension=php_memcache.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_netools.dll
;extension=php_ntuser.dll
;extension=php_oci8.dll
;extension=php_oggvorbis.dll
extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_parsekit.dll
extension=php_pdf.dll
extension=php_pdo.dll
extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_perl.dll
;extension=php_pgsql.dll
;extension=php_phpdoc.dll
extension=php_pop3.dll
;extension=php_printer.dll
;extension=php_pspell.dll
;extension=php_radius.dll
extension=php_runkit.dll
extension=php_sdo.dll
extension=php_sdo_das_xml.dll
;extension=php_shmop.dll
extension=php_smtp.dll
;extension=php_snmp.dll
extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_ssh2.dll
;extension=php_stats.dll
;extension=php_sybase_ct.dll
;extension=php_threads.dll
extension=php_tidy.dll
extension=php_timezonedb.dll
;extension=php_translit.dll
;extension=php_win32ps.dll
;extension=php_win32scheduler.dll
;extension=php_win32service.dll
;extension=php_win32std.dll
;extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_yaz.dll
extension=php_zip.dll
extension=php_zlib_filter.dll
-
Minimum - The minimum number of extensions a server should have.
;extension=php_apc.dll
;extension=php_apd.dll
;extension=php_bcompiler.dll
;extension=php_big_int.dll ; Not an official extension. Replaced by gmp.
;extension=php_bitset.dll
;extension=php_blenc.dll
;extension=php_bz2.dll
;extension=php_bz2_filter.dll
;extension=php_classkit.dll ; Replaced by runkit
;extension=php_cpdf.dll
;extension=php_crack.dll
extension=php_curl.dll
;extension=php_cvsclient.dll
;extension=php_db.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_dio.dll
;extension=php_docblock.dll
extension=php_domxml.dll
;extension=php_event.dll
extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_fileinfo.dll
;extension=php_filepro.dll
;extension=php_filter.dll
;extension=php_fribidi.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
;extension=php_gopher.dll
extension=php_hash.dll
;extension=php_http.dll
;extension=php_hyperwave.dll
;extension=php_ibm_db2.dll
;extension=php_id3.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imagick.dll
;extension=php_imap.dll
;extension=php_ingres.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_json.dll
;extension=php_ldap.dll
;extension=php_lzf.dll
;extension=php_mailparse.dll
;extension=php_mcrypt.dll
;extension=php_mcrypt_filter.dll
;extension=php_memcache.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_netools.dll
;extension=php_ntuser.dll
;extension=php_oci8.dll
;extension=php_oggvorbis.dll
extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_parsekit.dll
;extension=php_pdf.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_perl.dll
;extension=php_pgsql.dll
;extension=php_phpdoc.dll
;extension=php_pop3.dll
;extension=php_printer.dll
;extension=php_pspell.dll
;extension=php_radius.dll
;extension=php_runkit.dll
;extension=php_sdo.dll
;extension=php_sdo_das_xml.dll
;extension=php_shmop.dll
;extension=php_smtp.dll
;extension=php_snmp.dll
extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_ssh2.dll
;extension=php_stats.dll
;extension=php_sybase_ct.dll
;extension=php_threads.dll
;extension=php_tidy.dll
;extension=php_timezonedb.dll
;extension=php_translit.dll
;extension=php_win32ps.dll
;extension=php_win32scheduler.dll
;extension=php_win32service.dll
;extension=php_win32std.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll
;extension=php_zlib_filter.dll
-
All webserver - All extensions except those that are useless/harmful when run on a webserver.
;extension=php_apc.dll
;extension=php_apd.dll
;extension=php_bcompiler.dll
;extension=php_big_int.dll ; Not an official extension. Replaced by gmp.
;extension=php_bitset.dll
;extension=php_blenc.dll
extension=php_bz2.dll
extension=php_bz2_filter.dll
;extension=php_classkit.dll ; Replaced by runkit
extension=php_cpdf.dll
extension=php_crack.dll
extension=php_curl.dll
;extension=php_cvsclient.dll
extension=php_db.dll
extension=php_dba.dll
extension=php_dbase.dll
extension=php_dbx.dll
extension=php_dio.dll
extension=php_docblock.dll
extension=php_domxml.dll
extension=php_event.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_fdf.dll
extension=php_fileinfo.dll
extension=php_filepro.dll
extension=php_filter.dll
extension=php_fribidi.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_gopher.dll
extension=php_hash.dll
extension=php_http.dll
extension=php_hyperwave.dll
;extension=php_ibm_db2.dll
extension=php_id3.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imagick.dll
extension=php_imap.dll
;extension=php_ingres.dll
extension=php_interbase.dll
extension=php_java.dll
extension=php_json.dll
extension=php_ldap.dll
extension=php_lzf.dll
extension=php_mailparse.dll
extension=php_mcrypt.dll
extension=php_mcrypt_filter.dll
extension=php_memcache.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_msql.dll
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_netools.dll
;extension=php_ntuser.dll
;extension=php_oci8.dll
extension=php_oggvorbis.dll
extension=php_openssl.dll
;extension=php_oracle.dll
extension=php_parsekit.dll
extension=php_pdf.dll
extension=php_pdo.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_perl.dll
extension=php_pgsql.dll
;extension=php_phpdoc.dll
extension=php_pop3.dll
;extension=php_printer.dll
;extension=php_pspell.dll
extension=php_radius.dll
extension=php_runkit.dll
extension=php_sdo.dll
extension=php_sdo_das_xml.dll
extension=php_shmop.dll
extension=php_smtp.dll
extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite.dll
extension=php_ssh2.dll
;extension=php_stats.dll
;extension=php_sybase_ct.dll
;extension=php_threads.dll
extension=php_tidy.dll
extension=php_timezonedb.dll
;extension=php_translit.dll
;extension=php_win32ps.dll
;extension=php_win32scheduler.dll
;extension=php_win32service.dll
;extension=php_win32std.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_yaz.dll
extension=php_zip.dll
extension=php_zlib_filter.dll
-
All - All extensions
;extension=php_apc.dll
;extension=php_apd.dll
extension=php_bcompiler.dll
;extension=php_big_int.dll ; Not an official extension. Replaced by gmp.
;extension=php_bitset.dll
;extension=php_blenc.dll
extension=php_bz2.dll
extension=php_bz2_filter.dll
;extension=php_classkit.dll ; Replaced by runkit
extension=php_cpdf.dll
extension=php_crack.dll
extension=php_curl.dll
;extension=php_cvsclient.dll
extension=php_db.dll
extension=php_dba.dll
extension=php_dbase.dll
extension=php_dbx.dll
extension=php_dio.dll
extension=php_docblock.dll
extension=php_domxml.dll
extension=php_event.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_fdf.dll
extension=php_fileinfo.dll
extension=php_filepro.dll
extension=php_filter.dll
extension=php_fribidi.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_gopher.dll
extension=php_hash.dll
extension=php_http.dll
extension=php_hyperwave.dll
;extension=php_ibm_db2.dll
extension=php_id3.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imagick.dll
extension=php_imap.dll
;extension=php_ingres.dll
extension=php_interbase.dll
extension=php_java.dll
extension=php_json.dll
extension=php_ldap.dll
extension=php_lzf.dll
extension=php_mailparse.dll
extension=php_mcrypt.dll
extension=php_mcrypt_filter.dll
extension=php_memcache.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_msql.dll
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_netools.dll
extension=php_ntuser.dll
;extension=php_oci8.dll
extension=php_oggvorbis.dll
extension=php_openssl.dll
;extension=php_oracle.dll
extension=php_parsekit.dll
extension=php_pdf.dll
extension=php_pdo.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_perl.dll
extension=php_pgsql.dll
extension=php_phpdoc.dll
extension=php_pop3.dll
extension=php_printer.dll
;extension=php_pspell.dll
extension=php_radius.dll
extension=php_runkit.dll
extension=php_sdo.dll
extension=php_sdo_das_xml.dll
extension=php_shmop.dll
extension=php_smtp.dll
extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite.dll
extension=php_ssh2.dll
;extension=php_stats.dll
;extension=php_sybase_ct.dll
;extension=php_threads.dll
extension=php_tidy.dll
extension=php_timezonedb.dll
extension=php_translit.dll
;extension=php_win32ps.dll
extension=php_win32scheduler.dll
extension=php_win32service.dll
extension=php_win32std.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_yaz.dll
extension=php_zip.dll
extension=php_zlib_filter.dll
Note: All extensions as in all that work without additional downloads.
Now you have to install PHP with Apache.
First you'll have to Stop Apache. To do that open the Apache Monitor and click on Stop.

Now go to C:\Server\Apache2\conf and open httpd.conf

- At the bottom, add:
LoadModule php5_module C:/Server/php/php5apache2.dll
PHPIniDir C:/Server/php
AddType application/x-httpd-php .php
Mind that if you chose to install at a different location the paths should be different.
- Find
DirectoryIndex index.html index.html.var
and change it to:
DirectoryIndex index.php index.html index.htm index.html.var
Now move to C:\Server\public_html and add a file named "phpinfo.php" with the content:
<?php
phpinfo();
?>
Copy the files shown on the image to C:\Server\Apache2\

If you installed Apache2.2.x you'll have to do this aswell:
PHP's php5apache2.dll was made to work with Apache2.0.x only. You'll need to get the right file and unless you want to compile it yourself you'll have to download it. You'll have to follow the instructions in the readme file that comes with the zipfile. Omit everything after
# Add to your httpd.conf
Do NOT do what is written below that line. You have already done it.
Start Apache by opening the Apache Monitor and clicking start.

If you see messages "Module cannot be found" (you shouldn't) just find the module in php.ini and add a semicolon on the beginning of the line.
If PHP was installed correctly the status bar should show something like this:
Apache/2.0.58 (Win32) PHP/5.1.3
Now visit http://localhost/phpinfo.php (or http://127.0.0.1/phpinfo.php).
If you see information about your PHP install everything should work.
Done!
[TOP]
Remove the whole PHP folder. The only thing you might want to backup is your php.ini.
Remove the selected files from your Apache directory.

Follow the installation instructions up to the point where php.ini is edited. If you've backuped your php.ini you can just copy it to the php folder. You should check the extensions part though as these might have changed.
[TOP]
Just pretty much follow the images. Mind the comments below some images.

Next...

Custom install...

Change...

Let's change the path to C:\Server\MySQL so everything is in one place.
Ok then Next...

Install...


Skip this unless you really need to do that...

Installation complete. Now we need to configure the server.
Make sure you've checked the checkbox.





You can change the path if you need to. But you don't have to.


Probably the most important config screen.
You should check "Enable TCP/IP networking" checkbox but there is some risk involved. You should make sure that nobody will connect to that port except for you.
THe second checkbox is also imprtant. If you plan to write SQL which is not as strict or if you're using PHP software which has poorly written queries (vbulletin has problems) you should uncheck it. But you should leave it checked as you should write your SQL correctly.


Check both.

Here you can set the root user (It's something like the server admin if you didn't know) password. You can set it to whatever you like or uncheck the "Modify Security Settings" checkbox.
This will allow you to connect with "root" as the user and an empty string as the password. It's not secure but if no one else connects to you server (nobody should - it's a developement servers) it'll make life easier.


Done!
Now to test it.
This part assumes you have a Server with PHP installed.
Download phpMyAdmin from http://www.phpmyadmin.net/home_page/downloads.php.
Extract the file to your you Document Root\pma (C:\Server\htdocs\pma for example).
Edit "config.default.php" located in the pma folder.
- Find:
$cfg['PmaAbsoluteUri'] = '';
and change it to
$cfg['PmaAbsoluteUri'] = 'http://localhost/pma/';
- (optional) Find:
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')
and change it to
$cfg['Servers'][$i]['extension'] = 'mysqli'; // The php MySQL extension to use ('mysql' or 'mysqli')
The mysqli extension was made to use the new functionality introduced in MySQL 4.1 and up. phpMyAdmin can use it.
- (important) This is where you have to enter you database username and password
Find:
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
// with 'config' auth_type)
The only thing that needs to be changed is the "$cfg['Servers'][$i]['password'] = '';" part. You should set it to the password you choose for the root user account. If you decided to leave the password blank you can skip this step.
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = 'root user password'; // MySQL password (only needed
// with 'config' auth_type)
That would be it. Now visit http://localhost/pma/ and if don't see any error it works.
[TOP]
Zend Optimizer is a program the speeds up execution of PHP code and enables you to use code encoded by Zend Guard. Hosts usually have this installed.
Zend Optimizer's newest version is 3.0 Download (Windows x86 version) You'll need to register on zend.com if you haven't already.
The installation is very simple. Just run the installer.

Next.

Agree. Next.

Set the path to C:\Server\Zend\Optimizer so that everything will ordered nicely. You can set it to anything you like though. Next.

The installer should detect your Apache2 install automacily. If not select Apache 2.x and click on Next.

If you have followed the whole guide you should have you php.ini in C:\Server\php. If not, then you should set it to the folder in which you keep you php.ini.

This should be detected by the installer. If you have followed the whole guide it should be C:\Server\Apache2.

Again if you have followed the whole guide your document root should be C:\Server\public_html

Install. You will be asked if the install is allowed to stop you server. Agree.

Wait untill your server stops, starts and the install finishes.

Finish. Done!
[TOP]
Everything was made by Marek_mar. - Feel free to contact me if you have any suggestions or have spotted any errors.
Hosted by a friend, Owner of http://www.icdsoftware.net
04.05.2006 - Updated the guide as Apache, PHP and MySQL got updated.
23.04.2006 - Added the Zend Optimizer part of the guide.
22.04.2006 - Changed the extension part of the guide. It matches PHP5.1.2 extensions available from PECL. Added the "All webserver" category which has all extensions except those that are useless/harmful. The extensions are collapsed becouse they took up too much space.
I won't take any responsibility for the damage you might couse by using this tutorial. I will happily fix any errors.