Codefisher.org

News Feed

I have spent some time over the last few days setting up Apache to run with PHP and MySql. I thought I might share my experience on Windows XP. This was so I had a test server since I was sick of uploading pages to test them.

Installing Apache was the easiest part. I downloaded Apache 2.2 and followed the install prompts and it went fine. I then change the DocumentRoot value from DocumentRoot "D:/codefisher" to DocumentRoot "D:/codefisher" and <Directory "D:/server/Apache2/htdocs"> to <Directory "D:/codefisher"> so I could keep all my files in my preferred folder.

Next thing I tackled was MySql. I did not have much trouble with that either. I just sent though the prompts of were to install it. When setting it up the only thing I did that was not the default was tick add the MySql folder to PATH. Which basically means that from the command line I can access the files as though they were in C:\Windows\System32.

Next I wanted to see if MySql worked and I could import a sql file I had made with phpMyAdmin that had all the tables that this site uses. So I did this after mucking around trying to find out what I wanted to do. CREATE USER 'codefish'@'localhost' IDENTIFIED BY '*******';
CREATE DATABASE codefish;
GRANT ALL PRIVILEGES ON *.* TO 'codefish'@'localhost';
USE codefish;
source import.sql

So at this stage I had a working set up of Apache and MySql. Now I needed PHP, this is where the problems stared. I first install PHP 4.4 since that is what my host uses. But MySql 5, which I was using since you can't easily find and download MySql 4, uses some kind of encryption that PHP 4 does not support. So I had to completely delete PHP 4 and install PHP 5 since the other things I had tried to get it to work failed. If you want a link about it.

By this stage I was tired and just wanted it to work. But I was in for more trouble. I added this to my httpd.conf LoadModule php5_module "E:/server/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
. For getting the needed PHPIniDir "E:/server/php" to set the folder from which the php.ini comes. You have no idea how big a headache that caused me before I worked it out. I had put it in for PHP 4 what I installed that, but for some reason forgot to do so for PHP 5.

Finaly I plan on using some perl scripts on the site. So I wanted to see that up too. After installing it to E:/usr/, the reason for this being that I then don't have to change the files when moving then to my linux host, /usr/ is treated the same as E:/usr/ since starting a path with a / means to go to the root of the drive. This can also be applied to link on a web site, why mine all start with / not http://codefisher.org/ That was a great tip I pick up from an install guide I was reading. I also because of this moved where I have my local files to a path that matches that of the

The changes needed in the httpd.conf were to change Options Indexes FollowSymLink to Options Indexes FollowSymLinks ExecCGI and added AddHandler cgi-script .cgi .pl. A hello world type script works, so I am hoping every thing else does.