FAMP stands for “FreeBSD, Apache, MySQL and PHP”. The following procedure shows how you can install FAMP server on FreeBSD 11 using ‘pkg’ tool.
MySQL
Install MySQL using the following command.
pkg install mysql57-server
Once MySQL is installed we need to set the password for root user. Start the MySQL server once for setting the password for root.
/usr/local/etc/rc.d/mysql-server onestart
Edit /etc/rc.conf and add the following line to enable MySQL service.
mysql_enable="YES"
Restart MySQL server
/usr/local/etc/rc.d/mysql-server restart
Apache
Install Apache Web server using the following command.
pkg install apache24
Edit /etc/rc.conf and add the following line to enable Apache service.
apache24_enable="YES"
Check if Apache service can be started without errors.
/usr/local/etc/rc.d/apache24 start
Edit the file /usr/local/etc/apache24/httpd.conf and uncomment the following line and add the registered DNS address here. If the server doesn’t have a registered DNS name, enter its IP address instead of the FQDN. If there are any additional configurations to be done, edit the appropriate lines in this file.
ServerName www.example.com:80
Restart Apache server to test.
/usr/local/etc/rc.d/apache24 restart
PHP
Install PHP and related dependencies using the following command
pkg install php56 mod_php56
Check if the reference to the PHP5 module is added to the Apache configuration file.
cat /usr/local/etc/apache24/httpd.conf | grep php5_module
The output should be similar to the following. If the output is empty, add the line, or if line is commented, uncomment it.
LoadModule php5_module libexec/apache24/libphp5.so
Edit the file /usr/local/etc/apache24/httpd.conf and make the following changes
.... DirectoryIndex index.php DirectoryIndex index.php index.html AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Restart Apache service once the changes are made.
/usr/local/etc/rc.d/apache24 restart
Create a new file /usr/local/www/apache24/data/info.php and add the following lines to check the installation.
<!--?php phpinfo(); phpinfo(INFO_MODULES); ?--><!--?php phpinfo(); phpinfo(INFO_MODULES); ?-->
Use the following URL to load the web page.
http://ip-adress/info.php