Last active
December 22, 2015 11:28
-
-
Save edgarsandi/6465373 to your computer and use it in GitHub Desktop.
Compile PHP 5.5.3 with multiprocessing and opcache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure the prerequisites are installed. | |
# apt-get install \ | |
autoconf \ | |
automake \ | |
bison \ | |
build-essential \ | |
curl \ | |
enchant \ | |
git \ | |
php5-dev \ | |
php-pear \ | |
pkg-config \ | |
libxml2 \ | |
libxml2-dev \ | |
libapache2-mod-fastcgi \ | |
libssl-dev \ | |
libcurl4-nss-dev \ | |
libenchant-dev \ | |
libjpeg8 \ | |
libjpeg8-dev \ | |
libpng12-0 \ | |
libpng12-dev \ | |
libvpx1 \ | |
libvpx-dev \ | |
libfreetype6 \ | |
libfreetype6-dev \ | |
libt1-5 \ | |
libt1-dev \ | |
libgmp10 \ | |
libgmp-dev \ | |
libicu48 \ | |
libicu-dev \ | |
libmcrypt4 \ | |
libmcrypt-dev \ | |
libpspell-dev \ | |
libedit2 \ | |
libedit-dev \ | |
libghc-regex-pcre-dev \ | |
libpcre \ | |
libpcre3-dev \ | |
libsnmp30 \ | |
libsnmp-dev \ | |
libxslt1.1 \ | |
libxslt1-dev \ | |
libpq-dev \ | |
libtidy-dev \ | |
mcrypt \ | |
pcregrep \ | |
re2c \ | |
snmp \ | |
# pear install PHP_Archive-alpha | |
$ wget http://br2.php.net/get/php-5.5.11.tar.gz/from/this/mirror | |
$ tar -zxvf php-5.5.11.tar.gz | |
$ cd php-5.5.11 | |
$ cd ext | |
$ git clone https://github.com/krakjoe/pthreads.git | |
$ cd .. | |
$ rm configure | |
$ ./buildconf --force | |
sudo find / -type f \( -name "libpcre.a" -o -name "libpcre.so" \) | |
sudo cp /usr/lib/x86_64-linux-gnu/libpcre.a /usr | |
sudo cp /usr/lib/x86_64-linux-gnu/libpcre.so /usr | |
sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h | |
$ ./configure \ | |
--config-cache \ | |
--disable-rpath \ | |
--localstatedir=/var \ | |
--with-layout=GNU \ | |
--with-config-file-path=/etc/php5/apache2 \ | |
--with-config-file-scan-dir=$HOME/php/conf.d \ | |
--mandir=$HOME/php/share/man \ | |
--without-bz2 \ | |
--with-apxs2=/usr/bin/apxs2 \ | |
--with-curl=/usr/bin \ | |
--with-enchant \ | |
--with-fpm-user=www-data \ | |
--with-fpm-group=www-data \ | |
--with-freetype-dir=/usr \ | |
--with-gettext \ | |
--with-gd \ | |
--with-gmp \ | |
--with-iconv-dir=/usr \ | |
--with-icu-dir=/usr \ | |
--with-jpeg-dir=/usr \ | |
--with-kerberos \ | |
--with-libedit \ | |
--with-libxml-dir=/usr \ | |
--with-mcrypt=/usr \ | |
--with-mhash \ | |
--with-mysql-sock=/var/run/mysqld/mysqld.sock \ | |
--with-mysqli \ | |
--with-sqlite3=/usr \ | |
--with-mysql \ | |
--with-openssl \ | |
--with-openssl-dir=/usr/bin \ | |
--with-pcre-regex=/usr \ | |
--with-pdo-sqlite=/usr \ | |
--with-pdo-mysql=mysqlnd \ | |
--with-pear \ | |
--with-png-dir=/usr \ | |
--with-pspell \ | |
--with-readline \ | |
--with-regex=php \ | |
--with-snmp \ | |
--with-t1lib \ | |
--with-tidy \ | |
--with-vpx-dir=/usr \ | |
--with-xmlrpc \ | |
--with-xpm-dir=/usr \ | |
--with-xsl \ | |
--with-zlib \ | |
--enable-bcmath \ | |
--enable-calendar \ | |
--enable-cli \ | |
--enable-debug \ | |
--enable-exif \ | |
--enable-fpm \ | |
--enable-ftp \ | |
--enable-gd-native-ttf \ | |
--enable-gd-jis-conv \ | |
--enable-inline-optimization \ | |
--enable-intl \ | |
--enable-maintainer-zts \ | |
--enable-mbstring \ | |
--enable-mbregex \ | |
--enable-opcache \ | |
--enable-pcntl \ | |
--enable-phar \ | |
--enable-posix \ | |
--enable-pthreads=static \ | |
--enable-shmop \ | |
--enable-soap \ | |
--enable-sockets \ | |
--enable-sysvsem \ | |
--enable-sysvshm \ | |
--enable-sysvmsg \ | |
--enable-zip \ | |
--enable-zend-signals | |
$ make | |
$ make test | |
# make install | |
# cp php.ini-production /usr/local/lib/php.ini | |
# ln -s /usr/local/lib/php.ini /etc <- opcional, apenas para encontrar mais rapidamente o php.ini | |
## No arquivo /etc/php.ini | |
## Altere o date.timezone para America/Sao_Paulo | |
date.timezone = America/Sao_Paulo | |
# Adicione a extensão do opcache no php.ini | |
zend_extension = "<PATH TO OPCACHE>/opcache.so" | |
## Altere os valores do opcache para: (valores recomendados em: http://php.net/manual/pt_BR/opcache.installation.php) | |
opcache.enable=1 | |
opcache.enable_cli=1 | |
opcache.fast_shutdown=1 | |
opcache.memory_consumption=128 | |
opcache.interned_strings_buffer=8 | |
opcache.max_accelerated_files=4000 | |
opcache.revalidate_freq=60 | |
## In /etc/apache2/apache2.conf add: | |
LoadModule php5_module modules/libphp5.so | |
AddType application/x-http-php .php | |
DirectoryIndex index.php index.html | |
## Em alguns ambientes precisou instalar o libphp5.so | |
# apt-get install libapache2-mod-php5 | |
## No meu ambiente precisei habilitar o module actions | |
# a2enmod actions | |
# a2enmod rewrite | |
# /etc/init.d/apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment