Monday, August 16, 2010

--- Setting up Apache2, PHP5 and MySQL 5 on FreeBSD 8 via ports ---

- Apache 2

- cd /usr/ports/www/apache22
- make install clean
- Edit the configuration file at /usr/local/etc/apache22/httpd.conf
- If virtual hosting is enabled, then the /usr/local/etc/apache22/extra/httpd-vhosts.conf and httpd-userdir.conf files should be edited.
- Run the command apachectl start to start the webserver
- Add apache22_enable = "YES" to the /etc/rc.conf file to start apache at start up

- PHP 5

- cd /usr/ports/lang/php5
- make install clean
- cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini and then edit the php.ini file as per your requirement.
- Create the test php file on your web folder and restart apache (apachectl graceful).

- MySQL 5

- cd /usr/ports/databases/mysql50-server
- make install clean
- Add mysql_enable="YES" to /etc/rc.conf to start the server at system startup.

To enable the PHP-MySQL connectors, install the following ports

- /usr/ports/databases/php5-mysql, /usr/ports/databases/php5-mysqli and /usr/ports/databases/php5-pdo_mysql

Restart apache and view the PHP settings for the server ("phpinfo();" - enclose within php tags).

- Note - The ports should be installed as root. The PHP, PHP-MySQL settings are automatically added to the httpd.conf and php.ini files respectively.

No comments:

Post a Comment