httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jez Hancock <>
Subject Re: [users@httpd] Apache 1.3/PHP
Date Thu, 22 Jan 2004 23:19:48 GMT
Hi Tom,

On Thu, Jan 22, 2004 at 04:45:08PM -0500, Tom Ray [List] wrote:
> For the first time ever I installed FreeBSD 4.9, I then installed
> Apache 1.3 and PHP 4.3.3-CGI from /usr/ports on the machine. It seems
> that everything is ok, but when I try to use a .php file it does not
> run it through the parser. So when I hit test.php in my browser it
> outputs:
You will probably find it a lot easier to install the mod_php4 port NOT
the php4-cgi port - php running as cgi is not recommended unless you
have a good reason for doing so - ie you want to run php scripts as the
user that owns them.

For more info see this thread here:

A basic installation of apache+php on freebsd would be something like:

(note the below presumes you don't already have the ports installed, to
uninstall just run 'make deinstall' in each of the respective port

- install apache from ports:

cd /usr/ports/www/apache13 && make clean install

- install mod_php4 from ports:

cd /usr/ports/www/mod_php4 && make clean install
(choose the options you want, although the basics are fine to start with

- modify your /usr/local/etc/httpd.conf file so that the ServerName is
  set to a domain that resolves for you - localhost is ok as long as
  there's a line in /etc/hosts resolving localhost to

- finally start the httpd:

rehash && apachectl start

That should be all you need to do to get things up and running.  The
mod_php4 port install adds the required lines to your httpd.conf file:

LoadModule php4_module        libexec/apache/
AddModule mod_php4.c
<IfModule mod_php4.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

as well as an addition to the DirectoryIndex line so that index.php is
treated as being the default index page.

You shouldn't have to do anything special to get php scripts to work
from under the default DocumentRoot - which is /usr/local/www/data by
default iirc on freebsd.

If you find any errors in /var/log/httpd-error.log, paste them here and
someone can help out.

Jez Hancock
 - System Administrator / PHP Developer  - Another FreeBSD Diary        - ipfw peruser traffic logging

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message