Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » A Guide to Installing Apache, PHP, MySQL, and PHPMyAdmin on Windows
Reply
Old 02-18-2009, 03:39 AM   #1 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,681

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default A Guide to Installing Apache, PHP, MySQL, and PHPMyAdmin on Windows

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.



Accept the license agreement and press Next.



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



Choose Custom and press Next.



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



Press Install.



Press Finish.



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.



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.



Rename php.ini-dist to php.ini.



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"


Find DirectoryIndex and add index.php to the end.



Save and close httpd.conf.

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



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();

?>


Save phpinfo.php.

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



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.



Press Next.



Select Custom, and press Next.



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



Press Install.



Press Next.



Press Next.



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



Press Next.



Make sure Detailed Configuration is checked. Press next.



Make sure Developer Machine is checked. Press Next.



Make sure Multifunctional Database is checked, press Next.



Press Next.



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



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



Press Next.



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



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.



Press Execute.



Press Finish.



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.



Find:
Code:
extension_dir = "./"
Replace ./ with ./ext/



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.



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

Code:
;C:\WEB\PHP


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".



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.



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.



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.



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!
__________________

Need website help? PM me!

Last edited by CrazeD; 02-18-2009 at 03:46 AM.
CrazeD is online now   Reply With Quote
Old 02-18-2009, 04:20 AM   #2 (permalink)
zedman3d's Avatar
 
I am of the highest lvl..

Join Date: Oct 2007

Location: Sydney, Australia

Posts: 2,443

zedman3d will become famous soon enoughzedman3d will become famous soon enough

Default Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

I appreciate the effort you put into this. Good work.
__________________



My pick up line is: I know Vernong.

Trotter: "Ask all the questions you want... whatever we don't know, we'll make
up something that sounds pretty good."

Antec-User: "I have a display now, but the darn system is crash-bandicoot on stock"
zedman3d is offline   Reply With Quote
Old 02-18-2009, 08:00 AM   #3 (permalink)
Saxon's Avatar
 

Join Date: Feb 2007

Posts: 6,346

Saxon is just really niceSaxon is just really niceSaxon is just really niceSaxon is just really nice

Default Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

And this is getting a sticky.
__________________
I am not here for long I am deploying soon so please don't expect anything long winded.

Saxon is offline   Reply With Quote
Old 02-18-2009, 11:35 AM   #4 (permalink)
Baez's Avatar
 

Join Date: Sep 2005

Location: Toronto, Canada

Posts: 5,418

Baez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of light

Default 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
__________________

Baez is offline   Reply With Quote
Old 02-18-2009, 11:46 AM   #5 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,681

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

Yay, pictures work now.
__________________

Need website help? PM me!
CrazeD is online now   Reply With Quote
Old 02-18-2009, 11:56 AM   #6 (permalink)
Baez's Avatar
 

Join Date: Sep 2005

Location: Toronto, Canada

Posts: 5,418

Baez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of light

Default Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

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

Baez is offline   Reply With Quote
Old 02-19-2009, 10:49 PM   #7 (permalink)
Saxon's Avatar
 

Join Date: Feb 2007

Posts: 6,346

Saxon is just really niceSaxon is just really niceSaxon is just really niceSaxon is just really nice

Default Re: [TUTORIAL] Install Apache, PHP, MySQL, and PHPMyAdmin on Windows

Quote:
Originally Posted by Baez View Post
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.
__________________
I am not here for long I am deploying soon so please don't expect anything long winded.

Saxon is offline   Reply With Quote
Old 02-20-2009, 02:02 AM   #8 (permalink)
Baez's Avatar
 

Join Date: Sep 2005

Location: Toronto, Canada

Posts: 5,418

Baez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of lightBaez is a glorious beacon of light

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

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.
__________________

Baez is offline   Reply With Quote
Old 04-27-2009, 02:35 PM   #9 (permalink)
Seria's Avatar
 
PC Cutie ^_^

Join Date: Sep 2004

Posts: 511

Seria is on a distinguished road

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

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 -.-*
__________________

Last edited by Seria; 04-27-2009 at 04:07 PM.
Seria is offline   Reply With Quote
Old 04-27-2009, 07:23 PM   #10 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,681

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: A Guide to Installing Apache, PHP, MySQL, and PHPMyAdmin on Windows

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.
__________________

Need website help? PM me!
CrazeD is online now   Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On