Install Apache/PHP/MySQL on FreeBSD

To install Apache, run

pkg install apache24

Enable Apache with

vi /etc/rc.conf

Add

apache24_enable="yes"

Start Apache with

service apache24 start

Install php with

pkg install php74 mod_php74

Edit apache config and enable PHP

vi /usr/local/etc/apache24/httpd.conf

Add

DirectoryIndex index.php index.html


    SetHandler application/x-httpd-php



    SetHandler application/x-httpd-php-source

Restart Apache

service apache24 restart

At this point, PHP scripts will work using Apache.

Install MySQL server

pkg install mysql80-server

To auto start MySQL

echo mysql_enable="YES" >> /etc/rc.conf

To start MySQL server

service mysql-server start

Install phpMyAdmin

pkg install phpMyAdmin5-php74

Edit apache config

vi /usr/local/etc/apache24/httpd.conf

Add

Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"


Options None
AllowOverride Limit
Require all granted

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *