Not everyone would spend money online to buy webspace just so that they can test out how their latest application works, Well… Welcome to Vision Master Designs Blog. This tutorial will teach you to set up a developer environment for PHP/MySQL in your computer in no time.
- Page 1 : Introduction
- Page 2 : Create Directories & Install Apache
- Page 3 : Install PHP5 & Configure php.ini
- Page 4 : Configure Apache 2.2
- Page 5 : Installing & Configuring MySQL5
- Page 6 : Installing & Configuring PhpMyAdmin
If you are aware of the basics then Click Here to jump below, else read on.
Normally we can view HTML pages on our computer without the need of uploading them to the server, since HTML is a Client Side Language. You don`t need any extra software to view html files, just any browser will do the trick.
But if you want to make your pages dynamic using any Server Side Language (PHP,ASP,JSP) & want to the see the results then you must upload the file to the webserver which supports that language so it can execute the file & return the results on your browser
We can set up a developers environment from which you can create and execute PHP/MySQL scripts by installing the above mentioned applications.
- Apache HTTP Server (2.2.11): The best open source webserver. You need this to turn your humble computer to a powerful webserver to execute your applications.
Direct Download apache_2.2.11-win32-x86-no_ssl-r2.msi
Apache Download Page – Please Download the Win32 Binary without crypto (no mod_ssl) (MSI Installer) – apache_2.2.11-win32-x86-no_ssl.msi~ 4.3MB
- PHP (5.2.9) : One of the most powerful web programming languages.
Direct Download PHP 5.2.9 -2 zip package
PHP Download Page – Download the PHP 5.2.9 – 2 Zip package ~ 10MB
- MySQL (5.1.34) : One of the best DBMS packages which is free.
The latest version is 5.1.34 which is stable and used in production servers. Although MySQL 5.1 and MySQL 6 are also available as beta releases, they are not used in production servers as of now.
MySQL Download Page – Please download Windows ZIP/Setup.EXE (x86) 5.1.34 ~ 35.2MB
- PhpMyAdmin (3.1.4) : Used to manage your MySQL databases directly using your web browser.
Direct Download phpMyAdmin-3.1.4-all-languages.zip
PHPMyAdmin Download Page – Please download the latest release from the 3.x rooster.
The above downloads are compatible with Windows Vista/Vista SP1 (32 bit OS).
- Firstly lets make the required Directories. Create a ‘New Folder’ and rename it to ‘Server’ in your C: Drive. Inside the Server folder, create folder called ‘www’ and inside www create ‘myserver.dev’ and then finally create ‘public_html’ folder inside your myserver.dev
Follow this structure -> ‘C:\server\www\myserver.dev\public_html’
This is where you will be putting all your html,script etc files to be accessed by your webserver.
The following picture shows how the directory structure must look.
- Open up notepad, type in the following code and save the file as index.php inside C\:server\www\myserver.dev\public_html as shown in the above picture.
- Now install Apache, follow the instructions, accept the license then input the following settings as shown in the image below and donot modify anything after that, just keep clicking on next for the rest.
- Now type http://localhost/ in your web browser. If you get a message saying It works!, then it Works. Congratulations !
STEP 2 : Install PHP 5 and configure PHP.ini
- Now to install PHP5. Open the zip file & Extract all your files to ‘C:\server\php’, as shown in following the image.
- Search for the file ‘php.ini-recommended’ and rename it to ‘php.ini‘. See the above image for reference.
- Open up php.ini using any text-editor. (Notepad, Wordpad, Preferrably Dreamweaver)
- Search for
extension_dir = "./"
and replace it with (Please note the slashes)
extension_dir = "C:/server/php/ext"
- Search for the following lines individually. After you find them, remove ‘;‘ from each one of them.
Remove the ; from all these lines. ; is used to comment out these extensions from being used.
The First extension enables the Image GD library of PHP.
The Second enables mbstring.
The Third and forth enables us to use MySQL database.
- Save the php.ini file.
- Great ! Now we have to add tell the computer to start php everytime the computer reboots. So, Navigate to your Start->Control Panel->System->Advanced System Settings then go to the advanced tab, Click on the Environmental Variables button, then scroll down in system variables to find PATH, Edit it Add the following Code to it, as shown below in the image.
- Click Ok all the way and reboot your system.
- You MUST MUST MUST reboot a windows box after setting the Path variable (step 2). If you move on past that point without rebooting – logging off is NOT enough – apache will have trouble finding your mySQL extensions. Your phpInfo will not show those extensions and you’ll get an error in the apache log saying it can’t find the extension.
- Finally, Step 2 is over !. Now we have PHP configured. Lets move on to configuring Apache.
Extract PHP package
Modify php.ini file
The following part involves searching a given line and either editing it or replacing the line with a new line.Search the code given inside these types of boxes.Replace/Add the code given inside these types of boxes.
Adding Environmental Variables in the System path
STEP 3 : Configure Apache 2.2
- Now navigate to
C:\Program Files\Apache Software Foundation\Apache2.2\conf
- Try different text editor
- Stop Apache server from the taskbar and then try to edit
- You should have administrative previliges. Try disabling UAC
- If none of the above work. Reboot your computer in safe mode and then try to edit httpd.conf
- Open httpd.conf
The following part involves searching a given line and either editing it or replacing the line with a new line.
Search the code given inside these types of boxes.
Replace/Add the code given inside these types of boxes.
- Search for
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule rewrite_module modules/mod_rewrite.so
- Add these lines immediately after the previous step.
#PHP5 LoadModule php5_module "C:/server/php/php5apache2_2.dll" PHPIniDir "C:/server/php"
AddType application/x-gzip .gz .tgz
After that add
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
- Search for this line
Replace it to
DirectoryIndex index.html index.php
- Search for
- Now navigate to
C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra
- Open httpd-vhosts.conf
- Replace all the previous code with the following.
Options Indexes FollowSymLinks
Allow from all
- Finally navigate to C:\Windows\System32\drivers\etc
- Open up hosts in notepad/wordpad/dreamweaver any text editor and add the following
127.0.0.1 myserver.dev 127.0.0.1 www.myserver.dev
- Restart the Apache Webserver. If you have followed perfectly you`ll see that Apache has restarted perfectly.
- If Apache has restarted successfully then lets move on to the next step, i.e Installing & Configuring MySQL5
Open & Edit httpd.conf
Some users had reported that they weren`t able to edit httpd.conf in VISTA using Notepad. Try using Dreamweaver or any other editor to edit the *.conf files. If you are still not able to open httpd.conf file in any text editor, you can try the following solutions
The above is applicable for all *.conf files
Open & Edit httpd-vhosts.conf
Adding myserver.dev in hosts file
STEP 4 : Installing and Configuring MySQL5
- Lets start by unpacking the zip & start the installation. Select Typical, click Next
- Click Next after reviewing where you are installing
- Skip the Sign-up.
- Install SQL, Now time to configure SQL. Its pretty simple, if you follow the onscreen instructions.
- Now just follow the following images.
- Finally click on Execute and let mysql configure everything.
During the MySQL installation and configuration,if you have missed any step or have not configured properly, then you can run the MySQL Server Instance Config Wizard which can be accessed via ‘Start->All Programs->MySQL’.
*If MySQL Instance Wizard does not complete the final step, reboot your computer and configure again.*
- Now to test whether mysql & php along with apache are working fine, restart the webserver, i.e click on the apache icon in your taskbar (near time in the taskbar/startbar) and restart the webservice.
- After it has restarted (green play icon will be displayed), point your favourite web browser to http://www.myserver.dev.
- If you are able to see the above page, then you have successfully configured Apache+PHP5. To verify whether MySQL5 has been installed, scroll down the page until you come across mysql & mysqli heading as shown below.
- Woohoo ! Congratulations ! You have successfully installed Apache2.2.11+PHP5.2.9+MySQL5.1.34 on your system. *sigh*
STEP 5 : Installing and Configuring PhpMyAdmin 3
- Finally the last step in this tutorial. This is an optional ! You can use your webserver without it as well, but it just makes my life easier giving my GUI access to create,destroy,edit tables, databases etc.
- Extract all the files inside the phpMyAdmin-3.1.4-all-languages.zip to a C:\phpmyadmin. Now navigate inside C:\phpmyadmin you`ll see another folder named phpMyAdmin-3.1.4-all-languages (even if the name is something else), rename this folder to pma. Cut this renamed pma folder and paste it inside C:\server\www\myserver.dev\public_html
- Navigate inside the pma folder. Find the file config.sample.inc.php, rename it to config.inc.php. Now Open it and then replace all the code with the following
/* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
* Servers configuration
* First server
/* Authentication type */
/* Server parameters */
] = false;
/* Select mysqli if your server has it */
Save the file.
- Now If you have followed everything properly, when you point your web browser to http://www.myserver.dev/pma/index.php you will see a login screen or the following screen.
If you get the login screen, the username and password is root.
- If you are able to view this, then You have completed this tutorial successfully !!!!! *sigh*
Extract the PhpMyAdmin 3 package