Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VitaliyKuznetsov/234808d5ad74d9eaaea4898a4e45838c to your computer and use it in GitHub Desktop.
Save VitaliyKuznetsov/234808d5ad74d9eaaea4898a4e45838c to your computer and use it in GitHub Desktop.
Building PHP 5.6.2 with ZTS on Ubuntu 14.04 Trusty

Building PHP 5.6.2 with ZTS on Ubuntu 14.04 Trusty

1. Get dependences:

$ sudo apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libbz2-dev libjpeg-dev libfreetype6-dev libpng12-dev libxpm-dev libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev libt1-dev libgd2-xpm-dev libgmp-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev libmcrypt-dev libdb5.3-dev devscripts libjson-c-dev

$ sudo apt-get build-dep php5

IMPORTANT NOTE: If you have error when try to install build dependences for php5 - fix it with hands(usually you should downgrade your packages).


2.Prepare PHP 5.6.2 sources to build:

$ wget http://museum.php.net/php5/php-5.6.2.tar.gz
$ tar xfz php-5.6.2.tar.gz

3.Configure sources before build it:

1. Create shell script for configure tool:

# cd php-5.6.2
# touch configure_it.sh

2. Add these lines to this script:

./configure \
--enable-fpm \
--with-mcrypt \
--enable-mbstring \
--with-openssl \
--with-mysql \
--with-mysql-sock \
--with-gd \
--with-jpeg-dir=/usr/lib \
--enable-gd-native-ttf  \
--with-pdo-mysql \
--with-libxml-dir=/usr/lib \
--with-mysqli=/usr/bin/mysql_config \
--with-curl \
--enable-zip  \
--enable-sockets \
--with-zlib \
--enable-exif \
--enable-ftp \
--with-iconv \
--with-gettext \
--enable-gd-native-ttf \
--with-t1lib=/usr \
--with-freetype-dir=/usr \
--prefix=/opt/php-5.6.2_zts \
--with-config-file-path=/opt/php-5.6.2_zts/etc \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--enable-maintainer-zts

P.S: If you don't know how do it:

$ nano configure_it.sh

3. Make file executable and create directory for php:

$ chmod +x configure_it.sh
$ sudo mkdir /opt/php-5.6.2_zts

4. Build PHP:

  $ make
  $ make test
  $ make install

That's all. PHP 5.6.2 with ZTS support installed


IMPORTANT NOTES:

1. By default this PHP haven't php.ini file you must create and write it or copy from your another PHP installation.

2. If you want to run this PHP interpreter by default via "php" command you must run "update_alternatives":

$ sudo update-alternatives --install /usr/bin/php php /opt/php-5.6.2_zts/bin/php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment