A Guide to Installing Apache, PHP, MySQL, and PHPMyAdmin on Windows

CrazeD

Fully Optimized
Messages
3,736
Location
Maine
In this tutorial I will teach you how to manually install Apache, PHP, MySQL, and PHPMyAdmin on Windows (XP). The benefit of manually installing/configuring your webserver is that it is much more secure. Pre-configured WAMP's (like XAMPP, AppServ, etc) are made for development and not for actually running a website. You can use what you learn in this tutorial to actually run a website (though that is not this tutorial's purpose...this tutorial is simply for installing and configuring WAMP).

To get started, you will need to download the install files for each program.

APACHE --

1. Go to Download - The Apache HTTP Server Project.

2. Find the latest version (currently 2.2.11).

3. Download the "Win32 Binary without crypto (no mod_ssl) (MSI Installer): apache_2.2.11-win32-x86-no_ssl.msi".


MYSQL --

1. Go to MySQL :: MySQL 5.0 Downloads.

2. Download the Windows ZIP/Setup.EXE (x86) file.


PHP --

1. Go to PHP: Downloads.

2. Under Windows Binaries, download the latest ZIP package (currently 5.2.8)


PHPMYADMIN --

1. Go to phpMyAdmin - Download

2. Download the latest version (currently 3.1.2) english.zip.


INSTALLING APACHE--

Once you have the above four files, you may start installing Apache. Double click the apache_2.2.11-win32-x86-no_ssl.msi.

Click Next.

apache_next-1.jpg


Accept the license agreement and press Next.

apache_next-2.jpg


Type localhost for Network Domain and Server Domain. Type admin@localhost for Administrator's Email Address. Press Next.

apache_next-3.jpg


Choose Custom and press Next.

apache_next-4.jpg


Click Change and type C:\WEB\APACHE\. Press Next.

apache_next-5.jpg


Press Install.

apache_next-6.jpg


Press Finish.

apache_next-7.jpg


Open your internet browser and type http://localhost into the address bar. If Apache was installed properly, you will see "It Works!" in large font.

apache_next-8.jpg


If this is the case, move on to installing PHP.


INSTALLING PHP --

Navigate to C:\WEB in Explorer. Create a new folder called PHP. Open php-5.2.8-Win32.zip and extract all of its contents to C:\WEB\PHP.

php_copy.jpg


Rename php.ini-dist to php.ini.

php_renameini.jpg


Navigate to C:\WEB\APACHE\Conf. Open httpd.conf with a text editor. Scroll to the very bottom and add the following lines:

Code:
LoadModule php5_module "C:/WEB/PHP/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/WEB/PHP"

php_httpdconf.jpg


Find DirectoryIndex and add index.php to the end.

php_httpdconf-2.jpg


Save and close httpd.conf.

Restart Apache (click the tray icon and choose restart).

php_apacherestart.jpg


Navigate to C:\WEB\APACHE\htdocs. Create a new text document called phpinfo.php. Open phpinfo.php with a text editor. Type the following code:

Code:
<?

phpinfo();

?>

php_phpinfo.jpg


Save phpinfo.php.

In your internet browser, navigate to http://localhost/phpinfo.php.

php_phpinfo-2.jpg


If your screen looks similar to the above picture, you are ready to install MySQL!


INSTALLING MYSQL--

Open mysql-5.0.77-win32.zip. Open setup.exe.

mysql_setup.jpg


Press Next.

mysql_next-1.jpg


Select Custom, and press Next.

mysql_next-2.jpg


Press Change and type C:\WEB\MYSQL\. Press Next.

mysql_next-3.jpg


Press Install.

mysql_next-4.jpg


Press Next.

mysql_next-5.jpg


Press Next.

mysql_next-6.jpg


Make sure Configure the MySQL Server now box is ticked, and press Finish.

mysql_next-7.jpg


Press Next.

mysql_next-9.jpg


Make sure Detailed Configuration is checked. Press next.

mysql_next-10.jpg


Make sure Developer Machine is checked. Press Next.

mysql_next-11.jpg


Make sure Multifunctional Database is checked, press Next.

mysql_next-12.jpg


Press Next.

mysql_next-13.jpg


Make sure Decision Support (DSS)/OLAP is checked and press Next.

mysql_next-14.jpg


Make sure Enable TCP/IP Networking and Enable Strict Mode are checked. Use port 3306. Press Next.

mysql_next-15.jpg


Press Next.

mysql_next-16.jpg


Make sure Install As Windows Service is checked. Make sure Include Bin Directory in Windows PATH is unchecked. Press Next.

mysql_next-17.jpg


Make sure Modify Security Settings is checked. For this tutorial, I'm going to be using root as the password. If you are using this webserver publicly, I advise you choose a stronger password.

Make sure Create An Anonymous Account and Enable root access from remote machines are unchecked. Press Next.

mysql_next-18.jpg


Press Execute.

mysql_next-19.jpg


Press Finish.

mysql_next-20.jpg


Now we need to configure PHP to load MySQL. Navigate to C:\WEB\PHP. Open php.ini with a text editor.

Find:
Code:
;extension=php_mysql.dll

Remove the ; from the beginning.

php_ini.jpg


Find:
Code:
extension_dir = "./"

Replace ./ with ./ext/

php_ini-2.jpg


Save and close php.ini

We must add the PHP path to the Environment Variables, so let's do that now.

Open System Properties (right click My Computer and select Properties). Press the Advanced tab, and press Environment Variables.

php_envvar.jpg


Under System variables, find Path and click Edit. Go to the end of the line and add:

Code:
;C:\WEB\PHP

php_envvar-2.jpg


Press Ok, Ok, Ok.

Now, restart your computer to save the Environment Variable changes.

Once your computer has been restarted, navigate to http://localhost/phpinfo.php in your internet browser. Scroll down until you find "mysql".

php_phpinfo-3.jpg


If your screen looks like the above picture, you may move onto installing PHPMyAdmin.


INSTALLING PHPMYADMIN--

Open phpMyAdmin-3.1.2-english.zip. Navigate to C:\WEB\APACHE\htdocs. Extract the contents of phpMyAdmin-3.2.1-english.zip to the htdocs folder.

phpmyadmin_copy.jpg


Once the transfer is complete, rename phpMyAdmin-3.1.2-english to phpmyadmin.

Navigate to C:\WEB\APACHE\htdocs\phpmyadmin. Rename config.sample.inc.php to config.inc.php. Open config.inc.php with a text editor.

Find:
Code:
$cfg['Servers'][$i]['auth_type'] = 'cookie';

Change cookie to config.

phpmyadmin_config-2.jpg


Find:
Code:
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

Add Above:
Code:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'MYSQL_PASSWORD';

Change pma to root.
Change pmapass to the password that you used when you installed MySQL.
Change MYSQL_PASSWORD to the password that you used when you installed MySQL.

phpmyadmin_config.jpg


Navigate to http://localhost/phpmyadmin with your web browser. You should be automatically logged in and able to use PHPMyAdmin. If this is the case, congratulations, you are done my tutorial and now have a fully functional web server! :D :D
 
Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

I appreciate the effort you put into this. Good work.
 
Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

And this is getting a sticky.
 
Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

Moved to the main section. Sadly no one goes in the Tips and FAQ area so it won't be read.

Awesome work CrazeD :)
 
Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

Yay, pictures work now. :D
 
Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

Haha yeah the FAQ section doesn't allow for pictures either.
 
Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

Haha yeah the FAQ section doesn't allow for pictures either.

Seriously? That needs looking at, Think we need to talk to trotter about expanding this area.
 
Yeah it's a busy section now. A lot of programmers wanting to know about the C languages and Java specifically. I think we should have a section for each of the two of those and then a general section like this as well.
 
Thanks for this gread thread CrazeD,

I do not host sites on my own server, but I develop sites within my localhost (saves a lot of upload time) so this thread was a great help setting stuff up

MY QUESTION:
I'm creating a form in php which should email its gathered information however I'm getting this error:
Code:
Warning: mail() [function.mail]: Failed to connect to mailserver at
"localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
or use ini_set() in C:\WEB\APACHE\htdocs\WWW\training\6a.php on line 72
How would I setup the required "smtp_port" in the "php.ini" so that I can have my 'development code' send emails via my localhost?
I would assume its something special because this is what my php.ini file already contains:
Code:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com,
so I dont get what the problem is -.-*
 
Is this a Windows box?

I use ArGoSoft mail server to send test emails. I don't believe I had to change anything in the php.ini, though I will take a look. I can't really remember how it is setup because I haven't had to change anything with it in a long time.

I had a **** of a time getting a mail server to work though. ArGoSoft was the first one I've used that actually did what I wanted it to.
 
Back
Top Bottom