HOWTO: Apache, PHP and MySQL on windows ======================================= (c) 2005 David Salisbury I'm using Apache 2.0.55, PHP 5.1.1 and MySQL 5.0.16 for this tutorial. 1. Download latest files ========================= * For Apache, http://www.mirrorservice.org/sites/ftp.apache.org/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi * For PHP, http://www.php.net/get/php-5.1.1-Win32.zip/from/a/mirror * For MySQL, http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.16-win32.zip/from/http://www.mirrorservice.org/sites/ftp.mysql.com/ 2. Install Apache ========================= Run the .msi file that you downloaded. When you get to the Server Information page, put localhost into the first two boxes and in the final one put an email address. Make sure the first of the two options for Installing Apache is checked - "for all users on port 80...". Installing using typical or custom settings doesn't really matter. Choose where you want to install Apache into. I keep all my web stuff on drive F:, but you could also use a folder elsewhere and put Apache, MySQL and PHP into there. Once Apache has installed, close the installer. Open http://localhost/ in your web browser. You should see a dummy Apache Web Server page. This also means that so far, Apache is set up correctly. Stop Apache (Start->Programs->Apache HTTP Server 2.0.55->Control Apache Server->Stop). 3. Install PHP ========================= Extract the .zip file into somewhere on your system. Again, I've chosen my F: drive, in a folder called php5. 4. Configure Apache ========================= Open httpd.conf (it's in the Start menu, under Apache HTTP Server 2.0.55->Configure Apache Server) and find the following: #LoadModule ssl_module modules/mod_ssl.so After it, place LoadModule php5_module f:\php5\php5apache2.dll AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps (where F:\php5 is the folder you installed PHP into) Save and close. 5. Configure PHP ========================= In the folder you installed PHP into, rename php.ini-dist to php.ini and then open it. Find the line: extension_dir = "./" Replace it with extension_dir = "F:/php5/ext/" (where F:/php5 is the folder you installed PHP into) Now find ;extension=php_mysql.dll Remove the semi-colon from the beginning of the line. Save and close php.ini. Move php.ini to C:\WINDOWS 6. Installing MySQL ========================= Extract the MySQL setup files from the .zip you downloaded and run the MySQL installer. Choose the custom installation and install MySQL somewhere. Once it has installed, you are prompted to sign up to MySQL.com. This isn't essential so you can skip it. Check the "Configure the MySQL Server now" box and click finish. 7. Configuring MySQL ========================= Choose the "Standard Configuration" option. On the Service control page, accept the defaults. Check "Modify Security Settings" and enter a password for the root user (this is the superuser account) and proceed to the next page. Click execute and the config tool will set up MySQL for you. 8. Update libmysql.dll ========================= Delete F:\php5\libmysql.dll (where F:\php5 is the folder you installed PHP into) Copy F:\MySQL\MySQL Server 5.0\bin\libmySQL.dll to C:\WINDOWS, overwriting the file which is already there. (where F:\php5 is the folder you installed PHP into and F:\MySQL\MySQL Server 5.0 is the folder you installed MySQL into) 9. Testing everything ========================= Start the Apache Server. Open F:\Apache\Apache2\htdocs. Delete all the files in there (or move them into a new directory called "old_files" if you wish to keep the files). Create a new file and call it info.php. Open info.php in a text editor (Notepad will do). In the file, put the following: Save and close. Now go to http://localhost/info.php in your web browser. You should be presented with a long page which is headed "PHP Version 5.1.1". Scroll down the page and check that there is a section headed "mysql" and that the "Client API version" value is "5.0.16".