headermask image

header image

Apache-MySQLPHP Installation & Configuration Tutorial for Beginners :)

Hi,
This article is a very “narrow” tutorial aimed for complete beginners and dummies, who want to start off coding with AMP (Apache-MySQL-PHP) but do not want to read manual for installing and configuring them.
This write up is very specifically targeted and applies for Windows platform.

Note: To get the real and complete understanding, spend some time with the manuals. They are the best source of information.

Installing and Configuring PHP5 with Apache

  1. Select the most appropriate mirror for you from the following: http://www.apache.org/dyn/closer.cgi/httpd/binaries/win32/ (for Apache), and http://www.php.net/downloads.php for PHP.
  2. Download apache_1.3.x-win32-x86-no_src.exe and PHP 5.1.2 zip package (names PHP-5.x-win32).
    • DO NOT use Apache 2.x with PHP.
    • If you use PHP 4.x, make proper changes in the some of the steps given below.
  3. Note:

  4. Install Apache by simply clicking on the exe file. The default path is C:\Program Files\Apache Group\Apache.
  5. Unzip the PHP file to C:\PHP.
  6. Add C:\PHP to system path.
  7. Backup and rename php.ini.dist to php.ini.
  8. Copy php5ts.dll and php.ini to %systemroot%.
  9. Copy php5apache.dll to C:\Program Files\Apache Group\Apache.
  10. Open cmd (command prompt) and run net stop apache (to obviously stop the server).
  11. Backup httpd.conf, located in C:\Program Files\Apache Group\Apache\conf, and then open it in an editor to add the following lines:
    • LoadModule php5_module php5apache.dll
    • AddType application/x-httpd-php .php
    • AddModule mod_php5.c [If you face any problems, remove this line and check again]
  12. Net start Apache.
  13. To check if all everything is in place, write the following code in a notepad and save it as “phpinfo.php” (with inverted quotes).

<?php
phpinfo();
?>

  1. Place the file in your DocumentRoot directory. The default path is C:/Program Files/Apache Group/Apache/htdocs.
  2. Start your Mozilla Firefox browser (it’s not mandatory, just a recommendation :P ), and type http://localhost/phpinfo.php.
  3. If everything’s fine, we’ll see something like this:

phpinfo.jpg

Installing MySQL:

  1. We can find it in three shapes and sizes :D , The Complete Package, The Essentials Package and The Noinstall Archive. We’d go for the complete package named mysql-[version]-win32.
  2. The installation part is click next type.
  3. At the end of the installation, click to configure and choose the options as per your choice or as given below:
    • Detailed Configuration>Next
    • Developer Machine>Next
    • Multifunctional Database>Next
    • >Next
    • Manual Settings (choose 5)>Next
    • Enable TCP/IP (leave default port as 3306)>Next
    • Add to both, windows services and ssytem path>Next
    • Choose root password>Next
    • Execute.


Configuring MySQL & PHP:

  1. Open php.ini, located in %systemroot%, in and editor and uncomment the following line by removing the semicolon at the beginning of the line:

    • extension=php_mysql.dll
  2. Copy php_mysql.dll and libmysql.dll from C:\PHP\ext to C:\PHP.
  3. To verify the configuration and administer MySQL, one may use phpmyadmin, found at http://www.phpmyadmin.net/home_page/index.php. However, do make sure not to publish it along with the site :P .
  4. That’s it. Happy Coding (. For anymore queries, either leave your comments or refer to the manuals.

If you liked my post, feel free to subscribe to my rss feeds

3 Comments so far (Add 1 more)

  1. Its tooooooo nice ;)

    2. Narasimha on October 9th, 2007 at 11:36 am
  2. I followed the above steps with apache 2 and php5 but just cannot get the phpinfo() to work! Just cannot see where I could have gone wrong- keeps complaining cannot find php5apache2.dll when the path is right!

    3. ram on February 24th, 2008 at 7:44 pm
  3. Ram,
    I had written this pretty long ago, and as mentioned, the steps are for Apache1.x. Make necessary changes according to Apache2.x or Apache2.2.x.
    If a little playing around doesn’t help and you are a beginner, I’d suggest you go for xampp.

    4. Bipin 3~ Upadhyay on February 24th, 2008 at 10:55 pm

One Trackback

  1. [...] Posted by Bipin 3~ Upadhyay on August 8th, 2007 I am cuurently working on an official XSS (Cross Site Scripting) presentation. I needed some screenshots of alert boxes and defaced site. So I installed Apache, configured it to work with PHP. (If you need help in installing and configuring MySQL, Apache and PHP, look here). [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
Place your code as follows:
<pre name="code" class"language"> <pre/> language can be php, ruby etc.

WordPress database error: [Table 'projupa6_wordy.pau_categories' doesn't exist]
SELECT COUNT(*) FROM pau_categories