Installing Apache,MySQL,PHP from scratch on Windows.

Status
Not open for further replies.

litewarez

Active Member
1,367
2008
1
0
Installing Apache + PHP + MySql on Windows 32Bit operating system

Get Source files:

Apache: HTTPD - 2.2.15
PHP (TS): PHP - Thread Safe 5.3.2
MySql: MySQL 5.1.48

Ok so step 1 is to install Apache, Apache is the webserver, its the system that serves files to the browser
All other items such as PHP and MySql run along side Apache, you can think of them as Modules or Extensions.

The apache file we downloaded should be an MSI Installer, We want to open that up.

  • First window of the installation is just the Apache welcome, click Next.
  • The next window is is the "Terms in the Licence agreement", Accept them and click next.
  • You will be shown a screen explaining a "readme" about Apach, this is good to read so if you have time then do so.
  • The next page is your basic domain settings and the settings should be set as the following
    • Network Domain: localhost
    • Server Name: localhost
    • Administrator Email: webmaster@localhost
    • And select "For All Users" / port 80 and not 8080
  • 5. Next page is installation type, We want to select "Typical" and click Next.
  • 6. On the isntallation location we want to have a nice simple root so click browser and change location to "X:\localserver\apache", X being your drive name. MAKE SURE YOU YOU INSTALL APACHE TO THE APACHE FOLDER
  • 7. The screen is just a noticescreen saying the next click will start the installation. Just click the "Install" button to begin.

Ok so apache should take a few minutes to install as there is lots of files to be extracted
You may see the following, Security Priv Dialog, Just click Allow, and also some Command boxes, DO NOT CLOSE THEM.
Clcik finish when the isntallation has completed.

Ok so Apache is not installed and to check we can go to http://localhost/ and it should say "It Works!" in bold.

Ok so onto step 2 witch is installing PHP into Apache. as we have downloaded the Installer, Thread safe we can just launch the installer.

Ok so ill talk you threw the installation just as i have with Apache
  • The first screen will be a welcome, just click next.
  • The 2nd screen is the Licence screen, jsut agree and click Next.
  • OK so the next window is the directory where PHP Should be installed, We want to put it in our localserver folder under php, "X:\localserver\php".
  • IMPORTANT, This screen is the Apache intergration screen.. We want to select the radio icon that says "Apache 2.2.x Module" and click next.
  • This screen will ask you for the Apache config directory witch will be located "X:\localserver\apache\conf", use that directory for the Apache intergration.
  • This screen will allow you to install optional extras and extentions, Expand "Extenstions" and confirm that the follwoing are selected (MySql,MySqli,OpenSSL) - All other are optional but the defualt selected items are usually needed.
  • After clicking next once selected your extentions you will just see a confirm screen, and you can proceed the installation by clicking "Install".
  • Click Finish and thats php installation done.

During the installation PHP you may need to Give administration privilages in Windows 7.

Ok so lets test make sure that Apache and PHP Are moth configured corrently.

You will see a little icon in your taskbar showing the Apache menu, click it and then click restart.
Note: If you get an error message say failed or something along those lines open up a cmn from start menu and style the folowing:

Code:
cd X:\localserver\apache\bin
httpd -k isntall

--
Then if you check your icon in taskbar it should be green. :)
Navigate to "C:\localserver\apache\htdocs" and create a file name info.php and within this file put!

PHP:
<?php phpinfo(); ?>

and save it, if you go to "http://localhost/info.php" you should get a PHP Information page, this means PHP is running fine.

Relocated htdocs to the localserver root.
Open up C:\localserver/apache/conf/httpd.conf and find where it says
<Directory "X:/localserver/apache/htdocs"> and change the path to "X:/localserver/htdocs" and also change line 178 accordingly to the same path.
Relocate the folder htdocs from apache up one directory so it becomes X:/localserver/htdocs and restart Apache.
If you wish to make sure everything is still ok just goto http://localhost/test.php and make sure that the information is showing.

Ok so now to install MySql along side Apache and PHP.

Open the mysql installer we downloaded erlier (mysql-essential-5.1.48-win32)
  • The first screen of the installation is just another welcome so click next.
  • This screen is the "Type of installation" screen and we just want Custom !Important.
  • In the custom installation screen we want to change the install path to "X:\localserver\mysql\" so that we have all our main core stuff in one location! Click next
  • This window is a summery of the installation and you can just click Install now and watch the magic ;)

Notes: Unfortuantly im not sure how to change the Data Dir for mysql so that will have to be changed at a later date.

  • You will see a few screens promoting mysql Enterprize, you can just ByPass them all by clicking next until you see the original instalation window.
  • Click next to start configuring the Mysql Server.

#MySql Configuation Wizard
  1. Another welcome screen just click next
  2. Change to the Standerd Configuation box and click next.
  3. Make sure "Install As Windows Servers" is check and the Service name is MySQL.
  4. If you wis hto directly run mysql commands via cmd without navigating to the MySql bin directory select the "Include BIN Directory in windows path" Click next
  5. Tick Modify security Settings, and set teh username to root and then the password to root - Click next
  6. Click Execute.
  7. As we selected "Install as service" you may get some security dialogs show up in Windows 7, Just click Allow
  8. Click Finish

Now time to test the MySql server we can create a test database by follwoing the following instructions.

Open CMD again and type the follwing

Code:
cd X:\localserver\mysql\bin
mysql -u root -p

ENTER PASWORD:
Code:
root

You should now be logged in. so we run a command to see if its working

Code:
Show Databases;

We should get the follwing:
Code:
mysql> Show Databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

If there is no errors MySql is all working now.

PHP And MySql are all installed as services and Apache has the Apache Status program witch runs in staskbar.

Congratualtions, you have finish installing the 3 primary elemements of a server and confugired them :)

Say Thanks if you enjoyed it guys.
 
7 comments
Status
Not open for further replies.
Back
Top