A step by step guide on how to install PHP 5.x.x, Apache 2.2.x, phpMyadmin and MySql 5.x.
Have you ever thought of running your own web server before? Does that sound too geeky? Actually, configuring your own web server is an easy task if you have enough information to refer from especially when you encounter errors. Let me get straight to installions of softwares required to build a functioning web server. First you would need PHP and Apache. If you only plan to test your PHP scripts, then those two softwares are enough for you. You will use phpMyAdmin and MySql to store and handle databases such as log in information. O.K Let’s get started.
Note: If you’re new to programming, you should consider installing WAMP server. A pre-configured server package (Windows,Apache,MySql,PHP).
You don’t require any programming skills to install WAMP server. Click Here to go to WAMP server website.
Installation Guide
1.PHP
2.Apache Server
3.MySql Community Server
4.phpMyAdmin
Installing PHP
Download a Windows binary from http://windows.php.net/download. In this tutorial, I will use PHP 5.3.3 Win32 VC6 Thread Safe. Download. When you have finished download, follow the steps described below.
1. Unzip the folder into "C:/php". You can choose other direcotries as well such as "C:/server/php".
2. Rename "php.ini-development" to "php.ini"
3. Open "php.ini"
4. Search for and uncomment following lines,i.e, to delete ";" infront of each line.
* ;extension_dir = "/ext" (note:Add directory to "ext" folder. For example, "c:/php/ext".change it to your actual direcotory if different)
* ;extension=php_mysql.dll (e.g. change it to extension=php_mysql.dll. Follow the same procedure.)
* ;extension=php_mysqli.dll
* ;extension=php_pdo_mysql.dll
* ;extension=php_mbstring.dll
When you have finished, save and close php.ini.
5.Now you need to add path to PHP variables. Go to My Computer and go to properties (right-click) and then go to Advanced Settings. Click on Environmnet Variables tab (at the bottom in Windows 7). Chose PATH and click on Edit. You will see something like "C:\Program Files\". Append ";C:\php\ext" to that line. After editing, it should look like C:\Program Files\;C\PHP\ext. Do not forget to add ";" infront of C:/php/ext.
Since you have not installed any server you will not be able to run PHP scripts. Let’s get on to installing Apache server.
1.Download Apahce MSI Installer
2.Follow the instructions (difficulty: Easy)
3.Add "yourname.xyz" for domain names or any other extension might work. For email address, add anything@yourname.xyz. These are just examples. You can choose your own names. Don’t worry about those names at the moment,you can edit later.
4. Choose Typical installation.
5. Wait for a while
6. You’re done. No, not yet.Let’s configure your Apache server to handle php scripts.
7. Go to your Apache folder (e.g C:/Program Files/Apache Software Foundation/Apache2.2/) and open "conf" folder and search for "httpd.conf" file to edit. 8. In "httpd.conf" file, search for a block of lines starting with #LoadModule and add the following block to the end of those lines.
# Load php module
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
Note: For older versions of Apache2 use php5apache2.dll
9. Add the following to the end of the file:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
This code ensures that only files that end in .php are executed, for example, "abc.php.txt" will not be executed as PHP file but rather as a text file.
10. Now restart your computer for changes to take effect.
Testing your server
<?php
echo "Welcome to my Web Server!"; ?>
?>
Copy and paste the above code in Note Pad and save as "test.php" in your Apache htdocs directory. C:/Program Files/Apache Software Foundation/Apache2.2/htdocs
Now load your web server by entering http://127.0.0.1 or http://localhost in your browser. If your server is configured correctly it will out put the following code.
Welcome to my Web Server!
Cheers!
If you have any problem installing your server, you can contact me using Contact Us page. I will respond to your message.
Installing MySql Community Server
1. Download MySql 5.5.7 MSI Installer
2. Choose Typical Installation
3. Launch Configuration Wizard
4. Click Next. Choose Detailed Configuration.
5. Choose Developer Machine
6. Choose Multi-functional Database
7. Set directory path to "C:/Data".Click Next
8.Choose Decision Support (DSS)/OLAP. Click Next
9.Tick Enable TCP/IP networking and Add firewall exception for this port and Enable Strict mode. Click Next.
10.This step configures MySql as a Windows service. Check both boxes. Click Next.
11.Change root password. Do not allow root access from remote machines if you’re not sure about what to do with this.
12.Execute. Finished!
1.Download phpMyAdmin
2. Unzip the folder into htdocs folder under Apache folder. (e.g. C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/phpmyadmin)
3.You’re done.
4 You should be able to load phpMyAdmin by entering http://localhost/phpmyadmin in your web browser. If you encounter an error, it is possible that you did not configure PHP correctly. Make sure that mbstring.dll is loaded and "MySql/bin" is added to the PATH in environment variables as described above in PHP installation section.
If you have any question about this tutorail, you may contact me by using Contact Us page. I will respond to your messages. Thanks for visiting Any Web website. Happy Coding!