Here’s how you can install the Apache, MySQL, and PHP stack on a FreeBSD Unix server:
- Update the package repository:
sudo pkg update
- Install Apache HTTP server:
sudo pkg install apache24
- Start Apache and enable it to start at boot:
sudo sysrc apache24_enable="YES"
sudo service apache24 start
- Install MySQL server:
sudo pkg install mysql80-server
- Start MySQL and enable it to start at boot:
sudo sysrc mysql_enable="YES"
sudo service mysql-server start
- Install PHP:
sudo pkg install mod_php72
- Configure Apache to use PHP:
sudo echo "AddType application/x-httpd-php .php" >> /usr/local/etc/apache24/httpd.conf
- Restart Apache:
sudo service apache24 restart
After these steps, you should have a working LAMP stack on your FreeBSD Unix server.