In this article, we will learn how to install a LAMP (Linux, Apache, MySQL, PHP) environment on a FreeBSD 12 cloud server. The installation process is divided into the following steps.
Before beginning the installation, we update the operating system to the latest version and reboot the cloud server.
freebsd-update fetch install
pkg update && pkg upgrade -y
rebootInstall Apache using the following command:
sudo pkg install -y apache24
sudo sysrc apache24_enable=yes
sudo service apache24 startTo check the version of Apache, use:
httpd -vThe output will display as follows:
Server version: Apache/2.4.41 (FreeBSD)
Server built:   unknownIf accessing the cloud server's IP address http://IPAddress in a browser shows Apache's default page, it indicates that Apache has been successfully installed.

Install PHP using the following command:
sudo pkg install -y php73 php73-mysqli mod_php73Enable PHP-FPM:
sudo sysrc php_fpm_enable=yes
sudo service php-fpm startTo check the PHP version, use:
php -vThe output will display as follows:
PHP 7.3.15 (cli) (built: Mar  3 2020 01:30:41) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.15, Copyright (c) 1998-2018 Zend TechnologiesTo view the installed PHP modules, use:
php -mThe output will display as follows:
[PHP Modules]
Core
date
libxml
mysqli
mysqlnd
pcre
Reflection
SPL
standard
[Zend Modules]Install MySQL using the following command:
sudo pkg install -y mysql80-client mysql80-server
sudo sysrc mysql_enable=yes
sudo service mysql-server startTo check the MySQL version, use:
mysql -VThe output will display as follows:
mysql  Ver 8.0.19 for FreeBSD12.1 on amd64 (Source distribution)Then, run the MySQL installation configuration wizard:
mysql_secure_installationDuring the MySQL installation configuration wizard, we need to enter the root password and answer some security-related questions. Generally, it's sufficient to select the default values provided by the wizard.
Finally, restart Apache to work with PHP:
sudo apachectl restartThis concludes the tutorial on installing Apache, PHP, and MySQL on a FreeBSD 12 cloud server.
23-02-2024 02:02:07
22-02-2024 03:19:32
22-02-2024 03:16:03
22-02-2024 03:14:03
22-02-2024 03:11:58