Install apache, php5, and mysql on FreeBSD 7.2 using ports

June 17, 2009

Apache web server one of the most widely used. Apache can also be installed on freebsd. following way to install apache, PHP5, mysql the most easy to use ports.

1. Install Apache:

# cd /usr/ports/www/apache22
# make install clean

to start just type

# /usr/local/sbin/apachectl start

to enable apache on boot add apache22_enable=”YES” following file /etc/rc.conf

check apache on your browser type localhost

2. Install PHP 5

# /usr/ports/lang/php5
# make install clean

make sure to build Apache module is checked

add these option on file /usr/local/etc/apache22/httpd.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

create file php.ini by copy php.ini-dist

# cd /usr/local/etc/
# cp php.ini-dist php.ini

and then restart apache

# /usr/local/sbin/apachectl restart

create file php on /usr/local/www/apache22/data/

<?php phpinfo();?>

save as test.php

now test on your browser http://127.0.0.1/test.php

Install Mysql 5

# cd /usr/ports/databases/mysql51-server
# make install clean

create database

# /usr/local/bin/mysql_install_db

change owner and group as mysql

# chown -R mysql /var/db/mysql/
# chgrp -R mysql /var/db/mysql/

run mysql daemon

/usr/local/bin/mysqld_safe –user=mysql &

change mysql password

/usr/local/bin/mysqladmin -u root password newpass

to automatic msyql enable when boot add /etc/rc.conf:

mysql_enable="YES"

Install php5-mysql module

cd /usr/ports/databases/php5-mysql
make install clean

create file php to check mysql

<?php
$test=mysql_connect("localhost","mysql","");
if(!$test)
{
print "cant connect";
}
else
{
print "connected";
}
?>

save as test-db.php on /usr/local/www/apache22/data/ and go to your browser http://localhost/test-db.php

Reference:

1. install mysql on www.marksanborn.net
2. install apache on www.marksanborn.net
3. faruqafif.student.fkip.uns.ac.id
4. daemonforums.org

Tags: , , , , ,

2 Responses to “Install apache, php5, and mysql on FreeBSD 7.2 using ports”


  1. [...] Profesional v.6Installing Debian Lenny from a USB memory stick (USB HDD)How to install Cacti 0.8.7dInstall apache, php5, and mysql on FreeBSD 7.2 using portsHow to install Plugin Architecture Cacti and Mysql template for cactiHow to Install Usplash on [...]


Leave a Reply