Running PHP/MySQL in FreeBSD

Submitted by Paul <http://daemonsguide.iwarp.com/>

For those not familiar with this Unix flavor, please check www.freebsd.org for more information.

Needed Files

FreeBSD offers 3rd party programs in two forms, packages and ports. Packages are comparable with Linux RPM's and are fully compiled applications which the FreeBSD package manager will install for you. Ports are basically source distributions complete with needed makefiles. Installing them is as easy as typing 'make;make install'. Files it can't find will be fetched from servers.

MySQL

The easiest way is to get the MySQL-server package. Which can be found at http://www.freebsd.org/ports/ by entering 'mysql' into the search box. Please make sure on te 'results' page to select your FreeBSD version. You'll need the package for MySQL-Server. Just click on the link to download it and then (as root of course) run pkg_add . Follow the instructions given by the installer.

PHP3 + Apache

If you have a previous version of Apache installed, save it's httpd.conf/apache.conf file and remove it using the pkg_remove tool. Check your system to see if you have the ports collection installed. If so, go to the /usr/ports/www/apache13-php3 directory, type 'make', then 'make install' to install Apache + PHP3 module.

Configuration

You'll have to check the apache.conf file and enter Apache configurations as needed. PHP3 support has already been configured. Save the file and then start Apache from /usr/local/etc/rc.d/apache.sh. You can use /usr/local/sbin/apachectl configcheck to check your apache.conf file before doing so.