How To Install Apache, MySQL, PHP stack on FreeBSD Unix Server

Here’s how you can install the Apache, MySQL, and PHP stack on a FreeBSD Unix server:

  1. Update the package repository:
sudo pkg update
  1. Install Apache HTTP server:
sudo pkg install apache24
  1. Start Apache and enable it to start at boot:
sudo sysrc apache24_enable="YES"
sudo service apache24 start
  1. Install MySQL server:
sudo pkg install mysql80-server
  1. Start MySQL and enable it to start at boot:
sudo sysrc mysql_enable="YES"
sudo service mysql-server start
  1. Install PHP:
sudo pkg install mod_php72
  1. Configure Apache to use PHP:
sudo echo "AddType application/x-httpd-php .php" >> /usr/local/etc/apache24/httpd.conf
  1. Restart Apache:
sudo service apache24 restart

After these steps, you should have a working LAMP stack on your FreeBSD Unix server.

Leave a Comment