DivisionByZero

June 17, 2005

Setting up WAPP (Windows, Apache, PHP, and Postgresql)

Filed under: Computers

A few days ago, I set up WAPP (Windows + Apache + PHP + Postgresql) on my workstation. As much as I’d prefer working in a Linux box for systems development, I simply have no choice as I’m on a tight schedule (less than 20 days) to produce a working prototype. For that reason, I’m compelled to use Macromedia Dreamweaver MX 2004, hence the switch to Windows.

Initially, I expected to get everything up by a few hours. Instead, it took me almost two days before I was able to finally get something useful done. Unexpected behavior and lousy documentation from new binaries had me figuring out why some things never worked out on the new set-up.

For those trying to set-up WAPP on their workstations or servers (with the latest binary versions, that is), here are some notes to make your set up painless:

Postgresql 8.0 - Needs an NTFS partition for its data directory. If you are running on a FAT32 partition, you can convert your drive to NTFS by running this command:

convert /fs:ntfs

Apache (1.3.33) and PHP (4.3.11) - Apache by itself gives no problems, it’s when you try to attach the PHP module that things start to break. Below are the steps I used to make both of them run:

1. Add your PHP directory (usually C:\php) to the system path. For this, I make an autoexec.bat file and put the line:

SET PATH=%PATH%;C:\Php

By adding C:\Php to your system path, Windows can now find the php4ts.dll without you having to copy it into the C:\Windows\System32 directory. This is the recommended procedure as stated in the new install.txt file as it makes upgrading to newer PHP versions easier since you would only have to worry about a single directory.

2. Edit apache’s httpd.conf file (C:\Program Files\Apache Group\Apache\conf\httpd.conf) and add the following lines:

# Add to the end of the LoadModule section
LoadModule php4_module "C:/php/sapi/php4apache.dll"

Use the line above instead of the one stated in the install.txt file. php4apache.dll is located under the “sapi” directory and not in “C:/php.” That is a bug on the official PHP documentation.

# Add to the end of the AddModule section
AddModule mod_php4.c

# Add this line inside the conditional brace
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps

3. Run apache by typing “apache -k start” on the command prompt. For some strange reason, Apache with PHP does not start when you start it from the Services menu or by typing “net start apache” on the commandline.

To make things more convenient, you can make a desktop icon of the apache binary so you can start it easily. Once started, there is a command-prompt window that stays opened. To shutdown apache, just focus that box and type Ctrl-C.

6 Comments »

The URI to TrackBack this entry is: http://divisionbyzero.blogsome.com/2005/06/17/setting-up-wapp-windows-apache-php-and-postgresql/trackback/

  1. does conversion from fat32 to ntfs without reformatting the HD safe? im still using fat32.. :(

    thanks for the info matt.. try nako ug install ang apache + php.. mangutana lang dayon ko kung dili magwork.. :)

    Comment by shane — June 17, 2005 @ 5:54 pm

  2. matt,

    SET PATH=%PATH%;C:Php - unsa ning %PATH%? pareho ra ning autoexec.bat ug autoexec.cam? naa na may entry didto daan? sa next line nako ibutang?

    wala ko kasabot anang last 2 nga ibutang.. aha na pangitaon?

    pasensya na gyud.. kay wala gyud koy hanaw aning mga butanga.. hehehe :)

    Comment by shane — June 17, 2005 @ 6:09 pm

  3. > does conversion from fat32 to ntfs without reformatting the
    > HD safe? im still using fat32.. :(

    should be safe generally. i’ve done this a lot of times without any glitches. ntfs is the recommended filesystem for windows since it’s more secure (has file permissions support) and it’s more efficient in allocating disk space.

    > thanks for the info matt.. try nako ug install ang apache +
    > php.. mangutana lang dayon ko kung dili magwork.. :)

    no problem shane. you may also want to join the cdo linux user’s group (http://cdo.linux.org.ph). we just started last february, it’s basically a technical support group to help people who are using free/open-source software. hope to see you there.

    Comment by Administrator — June 18, 2005 @ 3:08 am

  4. > SET PATH=%PATH%;C:Php - unsa ning %PATH%? pareho ra ning
    > autoexec.bat ug autoexec.cam? naa na may entry didto daan?
    > sa next line nako ibutang?

    if you have an autoexec.bat file, edit that using notepad (or your preferred editor). then just add that line, preferrably at the end of the file. it won’t matter if there are other stuff already on the file as long as that command is executed.

    autoexec.bat is a file that is automatically run whenever you boot into windows. mura’g startup menu bah, only it’s run early in the boot process.

    %PATH% is a system variable that contains the current PATH of the system. the PATH is list of folders that the system looks for whenever you run a program. by, putting the line SET PATH=%PATH%;c:php, you want the system to add c:php in the PATH - this is so apache can find the php .dll without you copying it in c:windowssystem32

    Comment by Administrator — June 18, 2005 @ 3:17 am

  5. For manual installation, I would not recommend that you install php at the C: root directory, although that is the general instruction and the default location apache would look for php dll and binaries.

    I find it best to put it in the bin directory of the apache installation or in the same directory apache is located. Just my personal preference. ;)

    Comment by audienceone — June 18, 2005 @ 1:50 pm

  6. how do you make an autoexec.bat file?

    Comment by kate — March 26, 2008 @ 5:18 pm

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com