Install Apache Web server (with PHP) on FreeBSD:


To install Apache and PHP:
"sudo pkg install apache24 php74 mod_php74 php74-mbstring php74-zlib php74-curl php74-gd php74-json"

To enable Apache at boot:
"sudo sysrc apache24_enable=yes"

Create php.conf file and add these contents so apache can use php:
sudo nano /usr/local/etc/apache24/Includes/php.conf
contents:
<IfModule dir_module>
 DirectoryIndex index.php index.html
 <FilesMatch "\.php$">
  SetHandler application/x-httpd-php
 </FilesMatch>
 <FilesMatch "\.phps$">
  SetHandler application/x-httpd-php-source
 </FilesMatch>
</IfModule>

To start Apache after install:
"sudo service apache24 start"

The default location for Web files is; "/usr/local/www/apache24/data/"

--------------------------------------------------------------------------------
Source | Date: February 13th, 2021

Back