pkg install apache24

sysrc apache24_enable="yes"
# /etc/rc.conf
# apache24_enable="yes"

service apache24 start
# /usr/local/www/apache24/data/

安装 php:

pkg install php72 mod_php72 php72-ctype php72-mbstring php72-json php72-iconv php72-fileinfo php72-xml php72-session php72-dom php72-hash php72-gd php72-xmlreader php72-xmlwriter php72-openssl


# Files are automatically included if the name
# begins with a three digit number followed by '_'
# and ending in '.conf' e.g. '080_mod_php.conf'
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source

还需要在 httpd.conf中打开 mod_rewrite.