Install apache, php5, and mysql on FreeBSD 7.2 using ports
Last Updated on Sunday, 19 August 2012 12:26 Written by Admin Wednesday, 20 August 2008 18:11
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 cleanto start just type
# /usr/local/sbin/apachectl startto 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 cleanmake 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 .phpsAdd Index.php to load auto index
    DirectoryIndex index.html index.php
 create file php.ini by copy php.ini-dist
# cd /usr/local/etc/
# cp php.ini-dist php.iniand then restart apache
# /usr/local/sbin/apachectl restartcreate file php on /usr/local/www/apache22/data/
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 cleancreate database
# /usr/local/bin/mysql_install_dbchange 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 newpassto automatic msyql enable when boot add /etc/rc.conf:
mysql_enable="YES";Install php5-mysql module
cd /usr/ports/databases/php5-mysql
make install cleancreate file php to check mysql
    
    $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
 
				 
  
	














