Skip to content

Instantly share code, notes, and snippets.

@gtgt
Last active March 6, 2024 04:51
Show Gist options
  • Save gtgt/23bfda4a90908d7cb6b710203370711d to your computer and use it in GitHub Desktop.
Save gtgt/23bfda4a90908d7cb6b710203370711d 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