Matt's Blog

Installing Apache (again)

Fri May 4 17:32:03 EST 2007

The Facebook API looks pretty interesting, and has prompted me to have a look at CGI programming again. The first step in this process is to install Apache on my laptop, as editing code on my webserver in the UK from Australia rapidly becomes tedious due to the lag.

My webserver account uses suexec, so I want to install Apache with that in use. This requires setting the WITHAPACHESUEXEC=yes environment variable before installing the port. Don't install Apache yet though!

I also want to have php4 installed, with the mod_php Apache module. This is done by sudo make config in the lang/php4 directory and choosing the "Install Apache Module" option. Then sudo make install clean installs both php4 with apache13 being installed as a dependency.

Tested the webserver by going to localhost - that worked fine. Tested http://localhost/cgi-bin/test-cgi (one of the default examples installed along with Apache). This didn't work, changing the permission on /usr/local/www/cgi-bin-dist/test-cgi to 755 did though.

Changing the ScriptAlias directive to point at my /home/mattmcd/public_html/cgi-bin/ directory and changing the related directory path immediately below that meant that I could write cgi files in that directory and access them through http://localhost/cgi-bin/filename. So this achieves the basic functionality I was after, i.e. being able to access cgi files on my localhost through a web browser for testing purposes. Of course, this server setup is pretty silly - I really want to create a virtual server that points to my home directory rather than overwriting the default location for cgi scripts for the entire Apache installation. I'll leave this for the future at the moment, and when I need to do it I can have a look at my webhost setup.

Found [a tutorial on setting up CGI] that got Perl scripts working but killed the php files.

This is another problem with my existing setup, it seems that the webserver treats all files in the cgi-bin directory as cgi scripts, so the php files in that directory are not read correctly. Or maybe something else is going wrong. Again, leave exploring the subtleties of the Apache configuration file to a later date.

[unix]

[permalink]

code (31)

erlang (6)
ideas (24)
lisp (1)
me (15)
notes (6)
ocaml (5)
physics (46)
qo (7)
unix (7)
vim (4)