Apache, PHP, and MySQL
Updated: 07/25/2006
General Information
This guide will teach you how to set up a basic web server with Apache, PHP support, and MySQL for the database.Requirements
Installation
Section A -- Apache
|
# # |
cd /usr/ports/www/apache13 make install clean |
| # | echo 'apache_enable="YES"' >> /etc/rc.conf |
Note: For Apache2 users: Use the following instead.
|
# # # |
cd /usr/ports/www/apache2 make install distclean echo 'apache2_enable="YES"' >> /etc/rc.conf |
Section B -- PHP
|
# # |
cd /usr/ports/lang/php4 make config |
|
# # # |
make install distclean cd /usr/ports/lang/php4-extensions make install distclean |
Section C -- MySQL
|
# # # |
cd /usr/ports/databases/mysql41-server make install clean echo 'mysql_enable="YES"' >> /etc/rc.conf |
Configuration
Now we need to make sure Apache is configured for your website and that the PHP module is configured in the Apache config file.|
# # |
cd /usr/local/etc/apache nano httpd.conf |
|
LoadModule php4_module libexec/apache/libphp4.so AddModule mod_php4.c <IfModule mod_dir.c> DirectoryIndex index.php index.html index.htm </IfModule> |
|
ServerType standalone ServerName domain.tld NameVirtualHost 192.168.0.2 <VirtualHost 192.168.0.2> ServerName domain.tld ServerAlias www.domain.tld ServerAdmin admin@domain.tld DocumentRoot /path/to/website/files </VirtualHost> |
|
# # |
/usr/local/etc/rc.d/mysql-server.sh start /usr/local/sbin/apachectl start |
Author: Jon LaBass
jon at bsdguides dot org