Skip to content

Instantly share code, notes, and snippets.

@edwardstock
Last active March 19, 2017 10:43
Show Gist options
  • Save edwardstock/96e85df865342d661a40f61ee4dfdeb6 to your computer and use it in GitHub Desktop.
Save edwardstock/96e85df865342d661a40f61ee4dfdeb6 to your computer and use it in GitHub Desktop.
How to build PHP 7 (nginx + fpm+cli) on debian/ubuntu
#!/usr/bin/env bash
# getting deps
apt-get install -y git make gcc g++ autoconf re2c bison \
libxml2 libxml2-dev \
libevent-2.0* libevent-dev \
libssl1.0.0 libssl-dev \
libzip2 libzip-dev \
libbz2-dev \
libgd3 libgd-dev \
libmcrypt4 libmcrypt-dev \
libcurl4-openssl-dev \
libicu52 libicu-dev \
libreadline6 libreadline6-dev \
libxslt1.1 libxslt1-dev
# installing postgresql if you need, otherwise download mysql or something you need with DEV! version package
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
apt-get install -y postgresql-9.6 \
postgresql-9.6-pgmp \
postgresql-server-dev-9.6 \
postgresql-client-9.6
git clone https://github.com/php/php-src.git
git checkout php-7.1.3 # set required version from oficial repo https://github.com/php/php-src
# building autoconf scripts
./buildconf --force
# configuring sources
# ./configure --help to see another arguments
./configure \
--prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--libdir=/usr/lib64/php \
--includedir=/usr/include \
--datarootdir=/usr/share \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-sigchild=shared \
--enable-mbstring \
--enable-soap \
--enable-calendar \
--enable-inline-optimization \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl=shared \
--enable-mbregex \
--enable-exif \
--enable-bcmath \
--enable-zip \
--enable-gd-native-ttf \
--enable-ftp \
--enable-opcache \
--enable-fpm \
--enable-zend-signals \
--enable-phpdbg=shared \
--enable-shmop \
--enable-intl \
--with-readline \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--with-libxml-dir=/usr \
--with-curl \
--with-gd \
--disable-rpath \
--with-bz2 \
--with-zlib \
--with-mhash \
--with-pcre-regex \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-openssl \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-kerberos \
--with-gettext \
--with-xmlrpc \
--with-xsl \
--with-tsrm-pthreads
# make -j$NUM_THREADS - $NUM_THREADS count of threads for multithreaded compiling (sometimes can be a bug'gy)
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment