I have been learning PHP for last 1 year. I know it's a long time but I always get distracted and my studies come in the middle. And everytime I have to install PHP, I find myself in the deep mass of "readme"-material provided by the php community. That really sucks at times since it talks about almost all the servers available and how to install php on them.
If you want a hassle free installation of php on windows, go for Wamp. It installs Apache, MySQL and PHP in a single installation of Wamp. Pretty simple, isn't it?
But manual installation of php is 'recommended'. Also, if you play around with PHP's manual installation, you get to know about a lot of its funcionalities and tweak them.
Let's get started. You need Apache, MySQL, and PHP. Get 'em all. Install MySQL and Apache. This is pretty simple. So I am not going there.
  • For PHP, unzip the php-5.x.x.Win32.zip and put the files in your D: drive with the name "php". You can put the file in any other drive than C. Else everytime you install XP, you got to do the same steps again.
  • Go to D:\php directory and rename php.ini-dist to php.ini.
  • Now, open php.ini in your favourite text-editor (NPP for me ;) ) and look for the section called Dynamic Extensions. Under this section find the lines ";extension=php_mysql.dll" and ";extension=php_mysqli.dll". Now remove the the beginning semicolons from these two lines.
  • In the php.ini file, find the line ";error_reporting = E_ALL & ~E_NOTICE" and remove the beginning semicolon. This will show the errors that you make while coding.
  • Now, find the line "doc_root=" in php.ini and replace it with "doc_root='C:\Apache Software Foundation\Apache2.x\htdocs'" x is the version.
  • Find the line "extension_dir=" in php.ini and replace it with "extension_dir='D:\php\ext'"
  • Now, you have to edit httpd.conf which is located in the Apache installation folder. (i.e C:\Program Files\Apache Software Foundation\Apache2.x\conf). Open the httpd.conf file in notepad.
  • Append the following lines in the httpd.conf file:

    LoadModule php5_module "d:/php/php5apache2_2.dll"
    AddType application/x-httpd-php .php
    PHPIniDir "d:/php"

  • Finally, copy the libmysql.dll file from D:\php to C:\Windows\system32 folder.

You should be up and running if you have followed it properly! :) If you have any problem, do leave comment.

Labels: , ,

blog comments powered by Disqus