Tagged: FAMP

FreeBSD 10: Installing Apache 2.4, MySQL 5.5, and PHP5.5 — Missing libphp5.so

Continuing my quest with FreeBSD.

Today, I was installing Apache 2.4, MySQL 5.5, and PHP 5.5 (php55-5.5.11) on newly installed system. I've done this kind of installation many times on Linux so I didn't expect much of problems. Boy, I was wrong...

Apache and MySQL installation were straight forward and had no problem. After PHP installation, I couldn't find libphp5.so in /usr/local/libexec/apache24/! A little googling found articles/forums on older version of FAMP. They said its installation should be automatic or "Build Apache module" option needs to be selected, which I did not have such an option any where.

Then one thread mentioned something about configuring php conf file. So, I opened Makefile for PHP55: # vim Makefile ------------------------------------- ... OPTIONS_DEFINE+=APACHE CLI CGI FPM... OPTIONS_DEFAULT=APACHE CLI CGI FPM...

Compiled PHP55 again: # make install config ===> php55-5.5.11 doesn't install the Apache module anymore: update your OPTIONS and build www/mod_php55 port instead. *** Error code 1

Aha! www/mod_php55. I wonder if php installation didn't install mod_php55 but now I know what I need to do: # cd /usr/local/www/mod_php55/ # make install clean ... --- Zend/zend_dtrace_gen.h dtrace: failed to compile script /usr/ports/www/mod_php55/work/php-5.5.11/Zend/zend_dtrace.d: line 30: failed to resolve INP_IPV4: Unknown variable name ...

Hmm... I wonder if this was causing php55 installation to fail creating libphp5.so. Well, another googling found a suggestion/solution to load the dtraceall module: # kldload dtraceall # echo 'dtraceall_load="YES"' >> /boot/loader.conf

Now, mod_php55 was successfully installed as well as libphp5.so!

Here is the whole steps to install apache, mysql, and php:

NOTE: The steps below are not suitable for production use. Be warned!

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibility of end result after following these steps (although I will try to help if you send me your questions/problems).

Apache 2.4 - Installation and Configuration:

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

Edit /etc/rc.conf to make the Apache server will start automatically at system boot. # vim /etc/rc.conf ------------------------------------- apache24_enable="YES"

Test the Apache server installation using the following command: # /usr/local/etc/rc.d/apache24 start

MySQL - Installation and Configuration:

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

Start MySQL # /usr/local/etc/rc.d/mysql-server onestart

Update /etc/rc.conf # vim /etc/rc.conf ------------------------------------- mysql_enable="YES"

Set root password # rehash # mysqladmin -uroot password '<password>'

Create my.cnf # cp /usr/local/share/mysql/my-small.cnf /etc/my.cnf

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

PHP Installation and Configuration:

Here is the moment of truth. First, load the dtraceall kernel module, update the /boot/loader.conf file, and then install php55. # kldload dtraceall # echo 'dtraceall_load="YES"' >> /boot/loader.conf # cd /usr/ports/lang/php55 # make install clean

Check to see if libphp5.so is there # ls /usr/local/libexec/apache24/ httpd.exp mod_include.so mod_access_compat.so mod_info.so ...

Nope, it's not there. Then manually compile www/mod_php55/ # cd /usr/ports/www/mod_php55/ # make install clean

Now, check to see if libphp5.so is there again # ls /usr/local/libexec/apache24/ httpd.exp mod_include.so libphp5.so mod_info.so ...

Copy the PHP configuration file # cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Edit /usr/local/etc/apache24/httpd.conf file and add the following lines # vim /usr/local/etc/apache24/httpd.conf ------------------------------------- AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps

Add the following line under the LoadModule section if it's not there LoadModule php5_module libexec/apache24/libphp5.so

Edit the DirectoryIndex section DirectoryIndex index.php index.html

Now restart the apache server # /usr/local/etc/rc.d/apache24 restart

Let's see now if it can show a php page # vim /usr/local/www/apache24/data/index.php ------------------------------------- < ?php phpinfo(); ?>

VoilĂ ! It's working now!

phpinfo

That's all!
-gibb