HTTP Server: Apache 2.4

PHP method #1: Apache module

by ross at 12:35:47 on August 1, 2014

Don't forget you need ZTS (thread safety) enabled with PHP when using threaded MPMs.

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

Edit httpd.conf, make sure this line is present and not commented out:

LoadModule php5_module        libexec/apache24/

These modules should be commented out or absent: fcgid_module, proxy_fcgi_module.

Create apache24/modules.d/010_mod_php.conf:

<IfModule php5_module>
    <IfModule dir_module>
        DirectoryIndex index.php
    <FilesMatch "\.(php|phtml|inc)$">
        SetHandler application/x-httpd-php
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source

Restart Apache:

# service apache24 restart