Last Updated: February 25, 2016
·
719
· usirin

ubuntu12.04 and php5.5 related

Recently I found out that (yes just out because i am n00b) nginx+php-fpm through unix sockets has really good performance boost for ==php== execution. I tried to use the builtin packages of ubuntu for both php-fpm and php-cli. But the worst thing about them that they are still php5.3. I want to use php5.5, because at like i mentioned at my previous post, I started to use php5.5 specific apis. So, i decided to compile php5.5 from scratch. It seems really hard but, actually compiling from scratch gives you the power of using only necessary extensions of php.

What i understood from php.net documentation is that now the php-fpm is builtin to the php source code. it requires the necessary keywords in the configure phase. My php ./configure statement is like this:

'./configure'  \
        '--enable-opcache' \
        '--prefix=/opt/php' \
        '--with-mysql=mysqlnd' \
        '--with-mysqli=mysqlnd' \
        '--with-tidy=/usr' \
        '--with-curl=/usr/bin' \
        '--enable-openssl' \
        '--with-openssl' \
        '--with-zlib-dir=/usr' \
        '--with-xpm-dir=/usr' \
        '--with-pdo-mysql=mysqlnd' \
        '--with-xsl=/usr' \
        '--with-ldap' \
        '--with-xmlrpc' \
        '--with-iconv-dir=/usr' \
        '--with-snmp=/usr' \
        '--enable-exif' \
        '--enable-calendar' \
        '--with-bz2=/usr' \
        '--with-mcrypt=/usr' \
        '--with-gd' \
        '--with-jpeg-dir=/usr' \
        '--with-png-dir=/usr' \
        '--with-freetype-dir=/usr' \
        '--enable-mbstring' \
        '--enable-zip' \
        '--with-pear' \
        '--with-libdir=/lib/x86_64-linux-gnu' \
        '--with-config-file-path=/opt' \
        '--enable-fpm' \
        '--with-fpm-user' \
        '--with-fpm-group' \
        '--enable-sockets' \
        '--with-sockets'

i am installing php to the /opt/php/ just for personal habits. So, in order to have the php as global, you can type export PATH=/opt/php/bin:$PATH to your ~/.bashrc or ~/.zshrc or whatever shell type you're using.

this will give you many errors if you don't have the necessary libraries are not installed in your computer. To get around from this you can execute this command as root in ubuntu12.04:

apt-get build-dep php5

actually i didn't know about this command before, i manually apt-get'ed the necessary libraries one-by-one. So, i don't know if this command is really doing what is supposed to do. So, if you still get errors while you are configuring php, simple google search will help you. afaik:

apt-get install lib<library-name>-dev

command will work with almost every dependency.

one last thing, if you are compiling for your development environment and want the xdebug to work with, you can type the following as root on command line:

pecl install xdebug

this will install the xdebug, and the necessary compilings, but you still may need to make necessary edits to the php.ini file. if you're having errors about xdebug, add the following to your php.ini file:

zend_extension=xdebug.so