FAMP stands for “FreeBSD, Apache, MySQL and PHP. The following procedure shows how you can install FAMP server on FreeBSD 11 using ‘pkg’ tool.
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.
MySQL creates a initial root password and stores it as a file in the following name.
Change the password if needed
Edit /etc/rc.conf and add the following line to enable MySQL service.
Copy the sample MySQL configuration file to the path /etc/ as my.cnf. If there are any additional configuration to be done, edit the file my.cnf before restarting MySQL.
cp /usr/local/share/mysql/my-default.cnf /etc/my.cnf
Restart MySQL server
Install Apache Web server using the following command.
pkg install apache24
Edit /etc/rc.conf and add the following line to enable Apache service.
Check if Apache service can be started without errors.
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.
Restart Apache server to test.
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
<Directory "/usr/local/www/apache24/data"> .... DirectoryIndex index.php </Directory> <IfModule php5_module> DirectoryIndex index.php index.html AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule>
Restart Apache service once the changes are made.
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); ?>
Use the following URL to load the web page.