Well, i too took some time to configure PHP to connect with mysql database.
If you dont have time or patience to download individual installers and configuring them etc.. then download xampp and install it (I didnt try this but website says that it does everything for you).
Well, if you want to have the fun of doing it by yourself then the following info will be useful. Usually many people face difficulty in configuring mysql for php.(for the first time when we do this).
Download the latest versionf of the softwares required
I downloaded the following softwares for setting up everything.
you can start reading install.txt that can be found within the php root folder. it contains all the steps that you need to follow for your configuration (specific to OS and other things).
save a copy of php.ini-recommended as php.ini (within PHP root folder).
Configuring apache with PHP module:
you have to add the following lines into httpd.conf (assuming you are working on windows). in my case PHP is installed in C:/php5. you may want to change as per your local configuration.
#PHP related configuation
LoadModule php5_module "C:/php5/php5apache2_2.dll"
AddType application/x-httpd-php .php
Thats it, you should be able to run PHP programs.
MySQL configuration in PHP.
With recent versions of PHP, MySQL is not bundled along with PHP distribution directly.For windows users mysql dll (libmysql.dll) is bundled with php distribution.
PHP doesnt implicit contain mysql support for 2 reasons
1. Most of the linux\unix systems have mysql versions installed already
2. MySQL comes with GPL License where as PHP follows apache (am i correct?) license.
Because of the above 2 reasons PHP doesnt support mysql directly. To work with mysql you need to do small configuration changes in the php.ini file.
set the extention_dir appropriately, inmycase it was:
extension_dir = "c:/php5/ext/"
then search for extension=php_mysql.dll
remove the semi colon (uncommenting the line).
save the php.ini file.
Now we also need to do small change. there is a library libmysql.dll which should be available in the path (it is referenced in the php_mysql.dll). So add the path to the file into the system PATH variable. shortcut here is placing the file into c:\windows folder (but this is not the right approach)
Now restart your apache. everything is configured now.