Install Apache, Mysql, Php on freeBSD

Install Apache24 Mysql and PHP on FreeBSD





hello. This time i will share how to install Apache Mysql and Php On freeBSD.
oke let's go.

1. Step One : Update System 
 update your system with the following command.  
 
# freebsd-update fetch
# freebsd-update install

2. Step Two : Installing Apache24

now installing apache with the command

# pkg install apache24

next, edit /etc/rc.conf with the text editor and add the following line to start apache on reboot.

apache24_enable=YES

next start apache with the following command.

# service apache24 start

and now apache24 installed on your system.
file site located in /usr/local/www/apache24/data/ the default "Its work!" apache page.

3.Step Three : Install Mysql5.6

next install mysql5.6 with the following command.

# pkg install mysql56-server

edit /etc/rc.conf again and add the following line to start mysql on reboot.

mysql_enable=YES

and running the following command to make some security modification to your MYSQL installation.

# mysql_secure_installation

Press "Enter" at Enter current password for root (enter for none)
Enter "y" at Set root password? [Y/n]
Now enter a new secure password for the root MySQL user
At Remove anonymous users? [Y/n], enter "y"
Enter "y" at Disallow root login remotely? [Y/n]
Remove the test database by entering "y" at Remove test database and access to it? Y/n]
Reload the privilege tables so your changes take effect by entering "y" at Reload privilege tables now? [Y/n]

Try accessing your Mysql with the command.

# mysql -u root -p

and mysql already installed on your system. next step intallation php56.

4. Step Four : Install Php5.6

install php5.6 wiht the following command.

# pkg install mod_php56 php56-mysql php56-mysqli

edit /usr/local/etc/apche24/httpd.conf the PHP file handler needs to be added and
DirectoryIndex should contain index.php.
 find the following line.

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

and add index.php after DirectoryIndex. and it will be like this.

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

and add the end of httpd.conf add the following line then save and exit.

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

now restart apache so your change httpd.conf take effect.
and create index.php file to test whether PHP is running correctly. and paste the following code.

<?php
echo"hello word";
?>

reload your ip in browser and you shoul see "Hello Word"
and done..FAMP already installed on your system.
enjoy it.

sorry for my bad english

Previous
Next Post »