Install Apache/PHP/MySQL on FreeBSD
To install Apache, run
1 |
pkg install apache24 |
Enable Apache with
1 |
vi /etc/rc.conf |
Add
1 |
apache24_enable="yes" |
Start Apache with
1 |
service apache24 start |
Install php with
1 |
pkg install php74 mod_php74 |
Edit apache config and enable PHP
1 |
vi /usr/local/etc/apache24/httpd.conf |
Add
1 2 3 4 5 6 7 8 9 |
DirectoryIndex index.php index.html <FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> |
Restart Apache
1 |
service apache24 restart |
At this point, PHP scripts will work using Apache.
Install MySQL server
1 |
pkg install mysql80-server |
To auto start MySQL
1 |
echo mysql_enable="YES" >> /etc/rc.conf |
To start MySQL server
1 |
service mysql-server start |
Install phpMyAdmin
1 |
pkg install phpMyAdmin5-php74 |
Edit apache config
1 |
vi /usr/local/etc/apache24/httpd.conf |
Add
1 2 3 4 5 6 7 |
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/" <Directory "/usr/local/www/phpMyAdmin/"> Options None AllowOverride Limit Require all granted </Directory> |