Mar 192009

Installing PHP 5 with MySQL Support for Apache

Posted by Umang Gajera
Filed under PHP | MySQL

Useful for anyone who wants to install PHP 5 with Apache and MySQL on Windows PC for development and learning.
If You haven’t installed Apache and are new to it here is a simple guide on Apache Web Server installation and configuration :
http://www.otomaate.com/blog/installing-configuring-apache-server/

STEP 1:
Download the latest PHP 5 installer (.msi) from:
http://www.php.net/downloads.php
Start the setup and click next.

STEP 2:
For webserver setup -> select Apache version which you have installed on your system , in my case its 2.2.x and then click next.

STEP 3:
Now to choose the Apache configuration directory click on browse and locate the configuration directory.
In my case its located at :
C:\Program Files\Apache Software Foundation\Apache2.2\conf.

CAUTION!
Note that this is a crucial step in PHP installation because PHP setup needs to modify the httpd.conf file for PHP to work with Apache else it won’t work unless you manually edit the httpd.conf file located in the “conf” folder under the Apache installation directory.

STEP 4:
Under “choose items to install” :
Expand “Extentions” and select MySQL and MySQLi to install it on your HDD. You may also want to install PEAR and PHP manual under “Extras”(I recommend doing so). Click next and then install to complete the installation.

STEP 5:
Verifying PHP installation :

Open Apache service monitor and restart the service. It must now detect PHP. Now open the document root folder - the default folder is htdocs located inside apache installation dir. In my case its the default i.e. htdocs however you can change it by editing httpd.conf file. Now create a file named phpinfo.php. Open the file and copy paste the following code :

<?php
phpinfo();
?>

Save the file and open your web browser. Type in localhost/phpinfo.php and hit enter. If PHP 5 installtion was successful you would see all the details of the php configuration on your system.

STEP 6:
To enable MySQL support for PHP 5 :

By default MySQL is not enabled in PHP 5. In order to make PHP 5 access MySQL functions you need copy the file libmysql.dll to the system32 folder inside the windows installation folder. The dll file libmysql.dll will be present inside the PHP 5 install dir once PHP 5 is installed.

END…

If you are still confused or still facing some problem or have some questions/ suggestions fell free to reply!

Copy the code below to your web site.
x 
Share and Enjoy:
  • Digg
  • Technorati
  • TwitThis
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • MySpace
  • Yahoo! Buzz

[Post to Twitter]  [Post to Plurk]  [Post to Yahoo Buzz]  [Post to Delicious]  [Post to Digg]  [Post to Ping.fm]  [Post to Reddit]  [Post to StumbleUpon] 

This entry was posted on Thursday, March 19th, 2009 at 1:11 am and is filed under PHP | MySQL. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply