Installing Apache on FreeBSD 7.0Written by Mark Sanborn: Aug 14, 2008
Now that you have MySQL installed you might want to install the famous Apache web browser on your FreeBSD system. This post will be a quick walk through for installing Apache with PHP5 with mostly default settings to help you get going quick.
To install the latest version of Apache run this as root:
`# cd /usr/ports/www/apache22
make install clean`
I find that the defaults are usually fine when compilling this since you will be adding the PHP5 module later. So when the options screen comes up just go ahead and hit ok.
Then once it is installed you can start it by doing
# /usr/local/sbin/apachectl start
To run apache www server from startup, add apache22_enable=“YES” to your /etc/rc.conf file.
You might then want to go to your webserver either by viewing in a console browser and pointing it to ‘127.0.0.1’ or use a networked computer with a browser and point it to your FreeBSD machine’s IP address.
To install the base language files do:
make install clean
When the options screen comes up make sure you select “build Apache module”.
Then open up ‘/usr/local/etc/apache22/httpd.conf’ and as instructed by the php5 port you will want to add index.php to the DirectoryIndex.
Then also as instructed by the PHP5 port add these lines near the bottom of the config.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Then you will need to create the php.ini file. For ease of getting this working fast. We will stick with the defaults. Just do…
/usr/local/www/apache22/data]# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
After you have added this you can go ahead and restart Apache to see your changes. To restart do:
You can test to see if php works easily by making a file called test.php in ‘/usr/local/www/apache22/data/’ with the regular phpinfo code. Then simply point your browser to ‘youripaddress/test.php’.
Need to print shipping labels on your site?
Checkout my product RocketShipIt for simple easy-to-use developer tools for UPS™ FedEx™ USPS™ and more.