Home arrow Journal arrow Configure Apache 2.4 and PHP 5.4 in FreeBSD
Configure Apache 2.4 and PHP 5.4 in FreeBSD PDF
Monday, 18 August 2014
We will install Apache 2.4 and PHP 5.4 from FreeBSD's ports.

First we will install Apache 2.4:

  cd /usr/ports/www/apache24
  make install clean

Then we will install PHP 5.4:

  cd /usr/ports/lang/php54
  make install clean

Then we will configure Apache. Edit /usr/local/etc/apache24/httpd.conf file and add index.php at IfModule dir_module section:

<IfModule dir_module>
    DirectoryIndex index.html index.php

Then add the following lines to httpd.conf file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

We will also need to install php5 module (mod_php5) for Apache in order for Apache to work with PHP:

  cd /usr/ports/www/mod_php5
  make install clean

Now we will start Apache:

  /usr/local/etc/rc.d/apache24 start

If you get the error:

AH01630: client denied by server configuration

it means you've use an older apache configuration. So for your server use something like this:

<Directory "/home/john/public_html">
  Options Indexes FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
  Require all granted

If you get the following warning when you try to start apache:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using web.example.org. Set the 'ServerName' directive globally to suppress this message

Then add the following line to your httpd.conf file:

  ServerName web.example.org

where web.example.org is your host+domainname.
Last Updated ( Monday, 18 August 2014 )
< Prev   Next >

Other BSD Systems





Best BSD firewall?