Installing PHP
16 Jun 2006 @ 01:45PM

Updated: 8 Apr 2010 @ 12:41PM
Now onto PHP. There is no PHP installer for us. We have to do this manually. But don't be afraid, it's not all that tough. Begin by creating a new folder on the root of the c: drive called PHP and unzip our PHP zip file into it. Be sure to maintain the zipped directory structure.

You should end up with something that looks like this:

Now we have to configure PHP and Apache to work with each other properly. Let's begin with php.ini. You'll find both a php.ini-dist and a php.ini-recommended in the c:PHP folder. Copy the php.ini-recommended and rename it to plain php.ini. Open it in a text editor and find the line that reads short_open_tag and set it to On. Now, do a search for extension_dir. You'll want to change it to read "ext/". Next, scroll down until you see a list of extensions. Find the one that reads ;extension=php_mysql.dll and remove the semicolon (;) from in front of it.

Short open tag, because that's how I code.Set the extension dir.
Enable the mysql extension.

We just finished the PHP setup. Next we configure Apache to take advantage of PHP. To begin, find your httpd.conf file. This should be located in your apache folder, in my case it's at c:Program FilesApache Software FoundationApache2.2conf. Open the file in a text editor and go to the bottom, then add the following lines:

Add this to the bottom of your httpd.conf file

Next, search for DirectoryIndex. It should read DirectoryIndex index.html index.html.var. Add a space and then index.php at the end of that. After you've done all this, click on your Apache server icon next to your system clock and choose restart. Congratulations... you should be set up now. Let's give it a quick test, shall we?

Navigate to your htdocs directory. It my case, that's in c:Program FilesApache GroupApache2htdocs. Just delete everything that's in here... it's just the default stuff. Next, create a new text file and name it index.php. Open it up in a text editor and put the following in it.

Your very first PHP program

Save the file, then point your browser to again. You may have to hit refresh (f5), but what you should get is a plain, white page that says "PHP Works". If you get a white page or an error, something broke. This isn't the place to talk about fixing the various installation problems that can occur. Either check my forums or google it. If you get the message as expected, congratulations. You now have a functional installation of PHP.
Comments (0)