Skip to content

Instantly share code, notes, and snippets.

@risyasin
Last active January 30, 2016 00:20
Show Gist options
  • Save risyasin/8b42849ff4b5786292d3 to your computer and use it in GitHub Desktop.
Save risyasin/8b42849ff4b5786292d3 to your computer and use it in GitHub Desktop.
PHP7 on Ubuntu 15.04 and 15.10 with php-fpm systemd
# mkdir /usr/src/php7
# cd /usr/src/php7
# aria2c https://gist.githubusercontent.com/risyasin/8b42849ff4b5786292d3/raw/eae0e67737bcb2f4eed6d72c24a6d560dd7161de/ubuntu-php7-install.sh
## php7 compile requirements
apt-get install -y git build-essential autoconf automake pkg-config libtool
apt-get install -y re2c
apt-get install -y bison
apt-get install -y openssl
apt-get install -y libssl-dev
apt-get install -y libxml2-dev
apt-get install -y libmcrypt-dev
apt-get install -y libjpeg-dev
apt-get install -y libbz2-dev
apt-get install -y libedit-dev
apt-get install -y libxslt1-dev
apt-get install -y libgmp-dev
apt-get install -y libgmp10
apt-get install -y libxpm-dev
apt-get install -y libpng-dev
apt-get install -y libwebp-dev
apt-get install -y libldap2-dev
apt-get install -y libtokyocabinet-dev
apt-get install -y libcurl4-gnutls-dev
apt-get install -y libicu-dev
apt-get install -y libtcd-dev
apt-get install -y libc-client2007e-dev
apt-get install -y libkrb5-dev
apt-get install -y libpq-dev
apt-get install -y libreadline-dev
apt-get install -y libtidy-dev
apt-get install -y libfreetype6-dev
apt-get install -y libmysqlclient-dev
apt-get install -y libpspell-dev
apt-get install -y librecode-dev
apt-get install -y freetds-dev
apt-get install -y libsybdb5
apt-get install -y unixodbc-dev
## missing links
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so
ln -s /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 /usr/lib/liblber.so
ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so
cd /usr/src/php7
git clone https://github.com/php/php-src.git
## prepare php7 sources
cd /usr/src/php7/php-src/
./buildconf
make clean
./configure \
--prefix=/usr/local \
--localstatedir=/usr/local/var \
--sysconfdir=/etc/php7 \
--with-config-file-path=/etc/php7 \
--with-config-file-scan-dir=/etc/php7/conf.d \
--mandir=/usr/local/share/man \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--disable-debug \
--disable-phpdbg \
--enable-calendar \
--enable-mbregex \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-sockets \
--enable-ftp \
--enable-exif \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-wddx \
--enable-soap \
--enable-intl \
--enable-mysqlnd \
--enable-opcache \
--enable-pcntl \
--with-curl \
--with-xmlrpc \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-bz2 \
--with-tcadb \
--with-gettext \
--with-mhash \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-tidy \
--with-libedit \
--with-pdo-pgsql \
--with-readline \
--with-freetype-dir=/usr \
--with-icu-dir=/usr \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-webp-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-iconv-dir=/usr \
--with-unixODBC=/usr \
--with-pdo-odbc=unixODBC,/usr \
--with-openssl \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-gettext=/usr \
--with-pdo-dblib \
--with-zlib=/usr \
--with-bz2=/usr \
--with-xsl \
--with-libxml-dir=/usr \
--with-ldap \
--with-pgsql \
--with-pdo-pgsql \
--enable-zend-signals
make -j2
make install
mkdir -p /etc/php7/conf.d
cp /usr/src/php7/php-src/php.ini-production /etc/php7/php.ini
cp /usr/src/php7/php-src/sapi/fpm/php-fpm.conf /etc/php7/.
mkdir -p /etc/php7/fpm.d/
cp /usr/src/php7/php-src/sapi/fpm/www.conf /etc/php7/fpm.d/.
cd /etc/systemd/system/
aria2c https://gist.githubusercontent.com/risyasin/92075324caa9a46bfd5c/raw/7faecfe69c89ab72f016c504a8bfe65c70cbf001/php7-fpm.service
systemctl enable php7-fpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment