My custom optimized build of PHP 5.5 & PHP 5.4
Everyone has their own requirements of what they need enabled or not, this is my setup that I've used over the last couple of years. I have had the option of both PHP 5.4 and 5.5, but my personal preference is to go with the latest 5.5 releases.
apt-get install autoconf libxml2-dev libcurl3-dev libmysqlclient-dev libbz2-dev libsnmp9-dev libjpeg-dev libpng-dev libfreetype6-dev libmcrypt-dev libc-client-dev snmp
export PHP_VER=5.4.29
export PHP_PREFIX=php5.4
-- for php 5.3 - 5.4
wget "http://nl.php.net/distributions/php-$PHP_VER.tar.gz" -O php-$PHP_VER.tar.gz
tar xfz "php-$PHP_VER.tar.gz"
cd "php-$PHP_VER"
export PHP_VER=5.5.13
export PHP_PREFIX=php5.5
cd /app/sources/
rm php* -fr
-- for php 5.5
wget "http://dk1.php.net/get/php-$PHP_VER.tar.bz2/from/www.php.net/mirror" -O php-$PHP_VER.tar.bz2
tar xjf "php-$PHP_VER.tar.bz2"
cd "php-$PHP_VER"
### compile
touch ac*;
./buildconf --force
./configure \
--enable-fpm \
--enable-opcache \
--prefix=/app/${PHP_PREFIX} \
--disable-all \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-snmp \
--with-zlib \
--with-openssl \
--with-snmp \
--with-gd \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/lib32 \
--with-png-dir=/usr/lib32 \
--with-gettext \
--enable-pdo \
--enable-inline-optimization \
--enable-mbstring \
--enable-filter \
--enable-session \
--enable-json \
--enable-hash \
--disable-debug \
--without-sqlite3 \
--enable-bcmath \
--enable-ctype \
--enable-libxml \
--enable-simplexml \
--enable-xml \
--enable-xmlwriter \
--enable-xmlreader \
--enable-sockets \
--enable-dom \
--with-mcrypt \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--enable-ftp \
--enable-zip \
--enable-xmlwriter \
--with-curl \
--enable-hash \
--with-iconv \
--enable-soap \
make -j4
make install
#### CHANGES
### PHP 5.4 -> 5.5
<< --enable-opcache ln -s /app/${PHP_PREFIX}/bin/php /usr/bin/php ln -s /app/${PHP_PREFIX}/bin/pear /usr/bin/pear ln -s /app/${PHP_PREFIX}/bin/pecl /usr/bin/pecl cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm update-rc.d -f php-fpm defaults
Most things should be self-explained, but note that if you go with PHP 5.4 that you should add --enable-opcache to the compile to use 'now' standard opcache of PHP.
Happy pasting!
apt-get install autoconf libxml2-dev libcurl3-dev libmysqlclient-dev libbz2-dev libsnmp9-dev libjpeg-dev libpng-dev libfreetype6-dev libmcrypt-dev libc-client-dev snmp
export PHP_VER=5.4.29
export PHP_PREFIX=php5.4
-- for php 5.3 - 5.4
wget "http://nl.php.net/distributions/php-$PHP_VER.tar.gz" -O php-$PHP_VER.tar.gz
tar xfz "php-$PHP_VER.tar.gz"
cd "php-$PHP_VER"
export PHP_VER=5.5.13
export PHP_PREFIX=php5.5
cd /app/sources/
rm php* -fr
-- for php 5.5
wget "http://dk1.php.net/get/php-$PHP_VER.tar.bz2/from/www.php.net/mirror" -O php-$PHP_VER.tar.bz2
tar xjf "php-$PHP_VER.tar.bz2"
cd "php-$PHP_VER"
### compile
touch ac*;
./buildconf --force
./configure \
--enable-fpm \
--enable-opcache \
--prefix=/app/${PHP_PREFIX} \
--disable-all \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-snmp \
--with-zlib \
--with-openssl \
--with-snmp \
--with-gd \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/lib32 \
--with-png-dir=/usr/lib32 \
--with-gettext \
--enable-pdo \
--enable-inline-optimization \
--enable-mbstring \
--enable-filter \
--enable-session \
--enable-json \
--enable-hash \
--disable-debug \
--without-sqlite3 \
--enable-bcmath \
--enable-ctype \
--enable-libxml \
--enable-simplexml \
--enable-xml \
--enable-xmlwriter \
--enable-xmlreader \
--enable-sockets \
--enable-dom \
--with-mcrypt \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--enable-ftp \
--enable-zip \
--enable-xmlwriter \
--with-curl \
--enable-hash \
--with-iconv \
--enable-soap \
make -j4
make install
#### CHANGES
### PHP 5.4 -> 5.5
<< --enable-opcache ln -s /app/${PHP_PREFIX}/bin/php /usr/bin/php ln -s /app/${PHP_PREFIX}/bin/pear /usr/bin/pear ln -s /app/${PHP_PREFIX}/bin/pecl /usr/bin/pecl cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm update-rc.d -f php-fpm defaults
Most things should be self-explained, but note that if you go with PHP 5.4 that you should add --enable-opcache to the compile to use 'now' standard opcache of PHP.
Happy pasting!
Comments
Post a Comment