Apache · Apache 2.4 · FAMP · MySQL · PHP · Web Server

Simple procedure for installing FAMP server using Pkg.

FAMP stands for “FreeBSD, Apache, MySQL and PHP. The following procedure shows how you can install FAMP server on FreeBSD 10.2 using ‘pkg’.

If you want to install FAMP server using ports collection you can look here.

MySQL

Install MySQL using the following command.

pkg install mysql56-server

Once MySQL is installed we need to set the password for root user. Start the MySQL server once for setting the password for root.

/usr/local/etc/rc.d/mysql-server onestart

Create a new password for root. In this case the password for root is ‘password’. Replace it with an appropriate password in your setup.

rehash
mysqladmin -uroot password 'password'

Edit /etc/rc.conf and add the following line to enable MySQL service.

mysql_enable="YES"

Copy the sample MySQL configuration file to the path /etc/ as my.cnf.

cp /usr/local/share/mysql/my-default.cnf /etc/my.cnf

Restart MySQL server

/usr/local/etc/rc.d/mysql-server restart

Apache

Install Apache Web server using the following command.

pkg install apache24

Edit /etc/rc.conf and add the following line to enable Apache service.

apache24_enable="YES"

Check if Apache service can be started without errors.

/usr/local/etc/rc.d/apache24 start

Edit the file /usr/local/etc/apache24/httpd.conf and uncomment the following line to suppress warning messages.

ServerName www.example.com:80

Restart Apache server to test.

/usr/local/etc/rc.d/apache24 restart

PHP

Install PHP and related dependencies using the following command

pkg install php56 mod_php56

Check if the reference to the PHP5 module is added to the Apache configuration file.

cat /usr/local/etc/apache24/httpd.conf | grep php5_module

The output should be similar to the following. If the output is empty, add the line, or if line is commented, uncomment it.

LoadModule php5_module libexec/apache24/libphp5.so

Edit the file /usr/local/etc/apache24/httpd.conf and make the following changes

<Directory "/usr/local/www/apache24/data">
....
DirectoryIndex index.php
</Directory>

<IfModule php5_module>
        DirectoryIndex index.php index.html
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
</IfModule>

Restart Apache service once the changes are made.

/usr/local/etc/rc.d/apache24 restart

Create a new file /usr/local/www/apache24/data/info.php and add the following lines to check the installation.

<?php
phpinfo();
phpinfo(INFO_MODULES);
?>

Use the following URL to load the web page.

http://<ip-address>/info.php
Advertisements

One thought on “Simple procedure for installing FAMP server using Pkg.

  1. hi , I am facing this problem…….. Can you help me?

    # /usr/local/etc/rc.d/apache24 restart
    /etc/rc.conf: Manager: not found
    Performing sanity check on apache24 configuration:
    Syntax OK
    apache24 not running? (check /var/run/httpd.pid).
    Performing sanity check on apache24 configuration:
    Syntax OK
    Starting apache24.
    (48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
    (48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    AH00015: Unable to open logs
    /usr/local/etc/rc.d/apache24: WARNING: failed to start apache24

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s