Skip to content

Instantly share code, notes, and snippets.

@cevin
Forked from gtgt/build-php-static.sh
Created April 21, 2022 00:36
Show Gist options
  • Save cevin/d63eaece097a8148ad8a2dcde1bbb97a to your computer and use it in GitHub Desktop.
Save cevin/d63eaece097a8148ad8a2dcde1bbb97a to your computer and use it in GitHub Desktop.
Script to build static php
#!/bin/bash
U=${SUDO_USER:=${USER}}
if [[ -x `which realpath` ]]; then
T=$(realpath ${BASH_SOURCE[0]:=${0}})
else
T=${BASH_SOURCE[0]:=${0}}
fi
D=$(dirname ${T})
#apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-turbo-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libtidy-dev libmemcached-dev imagemagick-dev msgpack-dev
PHP_VERSION=7.4.15
#wget https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz -O php-${PHP_VERSION}.tar.bz2
#tar -xzf php-${PHP_VERSION}.tar.gz
cd ${D}/php-${PHP_VERSION}/ext
#git clone https://github.com/krakjoe/apcu.git
#git clone https://github.com/krakjoe/apcu-bc.git
#git clone https://github.com/php-memcached-dev/php-memcached.git memcached
#git clone https://github.com/mkoppanen/imagick.git
#git clone https://github.com/msgpack/msgpack-php msgpack
cd ..
rm configure
./buildconf --force
./configure --prefix=/opt/nginx/php --with-config-file-path=/opt/nginx/php --with-config-file-scan-dir=/opt/nginx/php/php.ini.d --localstatedir=/opt/nginx/php \
--config-cache --disable-cgi --enable-static= --enable-shared= --with-tsrm-pthreads --disable-phpdbg --enable-xdebug \
--with-msgpack --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap \
--enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --without-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib \
--enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex \
--with-pdo-mysql --without-pdo-pgsql --with-mysqli --enable-embedded-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl \
--with-fpm-user=1000 --with-fpm-group=1000 --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --without-kerberos --without-imap --without-imap-ssl \
--enable-intl --with-pcre-jit --enable-apc --enable-apcu --with-curl --with-imagick --enable-memcached --enable-memcached-protocol --enable-memcached-msgpack --enable-memcached-msgpack \
--with-tidy --enable-shmop --with-gettext --with-xmlrpc --without-xsl --enable-opcache --enable-fpm
make
#statifier sapi/fpm/php-fpm ../php-fpm-static.x64
#statifier sapi/cli/php ../php-static.x64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment