Created
August 8, 2015 14:52
-
-
Save malash/fcce7a63ba649a3b54a8 to your computer and use it in GitHub Desktop.
PHP 7 Compile Shell
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
apt-get update | |
apt-get install -y apt apt-transport-https bash binutils ca-certificates coreutils cpio dpkg \ | |
dpkg-dev e2fslibs e2fsprogs gnupg gpgv libapt-pkg4.12 libc-bin libc-dev-bin \ | |
libc6 libc6-dev libcgmanager0 libcomerr2 libcurl3-gnutls libdbus-1-3 \ | |
libdpkg-perl libdrm2 libgcrypt11 libgnutls26 libgssapi-krb5-2 libjson-c2 \ | |
libjson0 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.4-2 libss2 \ | |
libssl1.0.0 libtasn1-6 linux-libc-dev multiarch-support openssl patch \ | |
pkg-create-dbgsym tzdata libdb-dev libedit-dev libt1-dev libgmp-dev \ | |
autoconf libpq-dev apache2-dev systemtap-sdt-dev libxml2-dev libbz2-dev \ | |
libcurl4-openssl-dev libenchant-dev icu-devtools libicu-dev freetds-dev libsasl2-dev \ | |
unixodbc-dev libpspell-dev librecode-dev libsnmp-dev libtidy-dev libxslt1-dev php-pear \ | |
libvpx-dev libpng12-dev libfreetype6-dev libgd-dev libmcrypt-dev | |
tar zxf php-7.0.0*.tar.gz | |
cd php-7.0.0* | |
./buildconf --force | |
export CFLAGS="-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -O2 -Wall -fsigned-char -fno-strict-aliasing" | |
export PROG_SENDMAIL="/usr/sbin/sendmail" | |
#export EXTENSION_DIR="/usr/lib/php7/20141001" | |
# x64 | |
cp /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h | |
cp -r /usr/lib/x86_64-linux-gnu/libldap* /usr/lib/ | |
cp -r /usr/lib/x86_64-linux-gnu/libsybdb* /usr/lib/ | |
# x86 | |
#cp /usr/include/i386-linux-gnu/gmp.h /usr/include/gmp.h | |
#cp -r /usr/lib/i386-linux-gnu/libldap* /usr/lib/ | |
#cp -r /usr/lib/i386-linux-gnu/libsybdb* /usr/lib/ | |
#apache2 | |
if [ -d apache2-build ]; then rm -rf apache2-build; fi | |
mkdir apache2-build | |
cd apache2-build | |
../configure \ | |
--prefix=/usr --with-apxs2=/usr/bin/apxs2 \ | |
--with-config-file-path=/etc/php7/apache2 \ | |
--with-config-file-scan-dir=/etc/php7/apache2/conf.d \ | |
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-debug --with-regex=php --disable-rpath --disable-static --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --without-gdbm --with-iconv --enable-exif --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex --enable-shmop --enable-sockets --enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr --with-openssl --enable-soap --enable-zip --with-mhash=yes --with-system-tzdata --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-dtrace \ | |
--without-mm \ | |
--with-curl=shared,/usr \ | |
--with-enchant=shared,/usr \ | |
--with-zlib-dir=/usr \ | |
--with-gmp=shared,/usr \ | |
--with-jpeg-dir=shared,/usr \ | |
--with-xpm-dir=shared,/usr/X11R6 \ | |
--with-png-dir=shared,/usr \ | |
--with-freetype-dir=shared,/usr \ | |
--with-vpx-dir=shared,/usr \ | |
--enable-intl=shared \ | |
--without-t1lib \ | |
--with-ldap=shared,/usr \ | |
--with-ldap-sasl=/usr \ | |
--with-mysql=shared,/usr \ | |
--with-mysqli=shared,/usr/bin/mysql_config \ | |
--with-pspell=shared,/usr \ | |
--with-unixODBC=shared,/usr \ | |
--with-recode=shared,/usr \ | |
--with-xsl=shared,/usr \ | |
--with-snmp=shared,/usr \ | |
--with-sqlite3=shared,/usr \ | |
--with-mssql=shared,/usr \ | |
--with-tidy=shared,/usr \ | |
--with-xmlrpc=shared \ | |
--with-pgsql=shared,/usr PGSQL_INCLUDE=`pg_config --includedir` \ | |
--enable-pdo=shared \ | |
--without-pdo-dblib \ | |
--with-pdo-mysql=shared,/usr \ | |
--with-pdo-odbc=shared,unixODBC,/usr \ | |
--with-pdo-pgsql=shared,/usr/bin/pg_config \ | |
--with-pdo-sqlite=shared,/usr \ | |
--with-pdo-dblib=shared,/usr \ | |
--without-pear --disable-phar \ | |
--with-gd=shared,/usr --enable-gd-native-ttf \ | |
--enable-gd-jis-conv \ | |
--with-curl \ | |
--with-mcrypt \ | |
--with-libedit --with-readline | |
make | |
cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \ | |
../Zend/zend_ini_parser.h ../Zend/zend_language_parser.h \ | |
../Zend/zend_ini_parser.c ../Zend/zend_language_parser.c \ | |
Zend/ | |
make | |
touch configure-apache2-stamp | |
cd .. | |
#cgi | |
if [ -d cgi-build ]; then rm -rf cgi-build; fi | |
mkdir cgi-build | |
cd cgi-build | |
../configure \ | |
--prefix=/usr --enable-force-cgi-redirect --enable-fastcgi \ | |
--with-config-file-path=/etc/php7/cgi \ | |
--with-config-file-scan-dir=/etc/php7/cgi/conf.d \ | |
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-debug --with-regex=php --disable-rpath --disable-static --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --without-gdbm --with-iconv --enable-exif --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex --enable-shmop --enable-sockets --enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr --with-openssl --enable-soap --enable-zip --with-mhash=yes --with-system-tzdata --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-dtrace \ | |
--without-mm \ | |
--enable-pdo=shared \ | |
--enable-mysqlnd=shared \ | |
--with-mysql=shared,mysqlnd \ | |
--with-mysqli=shared,mysqlnd \ | |
--with-pdo-mysql=shared,mysqlnd \ | |
--without-pdo-sqlite \ | |
--without-sybase-ct --without-mssql \ | |
--without-sqlite3 \ | |
--enable-pcntl | |
#--with-db4 | |
make | |
# Dirty hack to not rebuild everything twice | |
cd main | |
sed -i -e 's/FORCE_CGI_REDIRECT 1/FORCE_CGI_REDIRECT 0/' -e 's/DISCARD_PATH 0/DISCARD_PATH 1/' php_config.h | |
sed -i -e 's/--enable-force-cgi-redirect/--enable-discard-path/' build-defs.h | |
touch ../../ext/standard/info.c | |
touch ../../sapi/cgi/cgi_main.c | |
cd .. | |
make | |
touch build-cgi-stamp | |
cd .. | |
# fpm | |
if [ -d fpm-build ]; then rm -rf fpm-build; fi | |
mkdir fpm-build | |
cd fpm-build | |
../configure \ | |
--prefix=/usr --enable-fpm --disable-cgi \ | |
--with-fpm-user=www-data --with-fpm-group=www-data \ | |
--with-config-file-path=/etc/php7/fpm \ | |
--with-config-file-scan-dir=/etc/php7/fpm/conf.d \ | |
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-debug --with-regex=php --disable-rpath --disable-static --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --without-gdbm --with-iconv --enable-exif --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex --enable-shmop --enable-sockets --enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr --with-openssl --enable-soap --enable-zip --with-mhash=yes --with-system-tzdata --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-dtrace \ | |
--with-libevent-dir=/usr \ | |
--without-mm \ | |
--disable-pdo \ | |
--without-mysql --without-sybase-ct \ | |
--without-mssql --without-sqlite3 | |
#--with-fpm-systemd | |
#--with-db4 | |
make | |
cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \ | |
../Zend/zend_ini_parser.h ../Zend/zend_language_parser.h \ | |
../Zend/zend_ini_parser.c ../Zend/zend_language_parser.c \ | |
Zend/ | |
make | |
touch configure-fpm-stamp | |
cd .. | |
# cli | |
if [ -d cli-build ]; then rm -rf cli-build; fi | |
mkdir cli-build | |
cd cli-build | |
../configure \ | |
--prefix=/usr --disable-cgi \ | |
--with-config-file-path=/etc/php7/cli \ | |
--with-config-file-scan-dir=/etc/php7/cli/conf.d \ | |
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-debug --with-regex=php --disable-rpath --disable-static --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --without-gdbm --with-iconv --enable-exif --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex --enable-shmop --enable-sockets --enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr --with-openssl --enable-soap --enable-zip --with-mhash=yes --with-system-tzdata --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-dtrace \ | |
--without-mm \ | |
--disable-pdo \ | |
--without-mysql --without-sybase-ct \ | |
--without-mssql --without-sqlite3 --enable-pcntl \ | |
--with-libedit | |
make | |
cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \ | |
../Zend/zend_ini_parser.h ../Zend/zend_language_parser.h \ | |
../Zend/zend_ini_parser.c ../Zend/zend_language_parser.c \ | |
Zend/ | |
make | |
touch configure-cli-stamp | |
cd .. | |
# embed | |
if [ -d embed-build ]; then rm -rf embed-build; fi | |
mkdir embed-build | |
cd embed-build | |
../configure \ | |
--prefix=/usr --enable-embed --disable-cgi \ | |
--with-config-file-path=/etc/php7/embed \ | |
--with-config-file-scan-dir=/etc/php7/embed/conf.d \ | |
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-debug --with-regex=php --disable-rpath --disable-static --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --without-gdbm --with-iconv --enable-exif --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex --enable-shmop --enable-sockets --enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr --with-openssl --enable-soap --enable-zip --with-mhash=yes --with-system-tzdata --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-dtrace \ | |
--without-mm \ | |
--disable-pdo \ | |
--without-mysql --without-sybase-ct \ | |
--without-mssql --without-sqlite3 --enable-pcntl | |
cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \ | |
../Zend/zend_ini_parser.h ../Zend/zend_language_parser.h \ | |
../Zend/zend_ini_parser.c ../Zend/zend_language_parser.c \ | |
Zend/ | |
make | |
touch configure-embed-stamp | |
cd .. | |
#install | |
# install extensions | |
cp cgi-build/sapi/cgi/php-cgi /usr/bin/php7-cgi | |
cp cli-build/sapi/cli/php /usr/bin/php7 | |
cp fpm-build/sapi/fpm/php-fpm /usr/sbin/php7-fpm | |
chmod +x apache2-build/scripts/phpize | |
cp apache2-build/scripts/phpize /usr/bin/phpize7 | |
chmod +x apache2-build/scripts/php-config | |
cp apache2-build/scripts/php-config /usr/bin/php-config7 | |
mkdir -p /etc/php7/fpm/pool.d | |
mkdir -p /etc/php7/fpm/conf.d | |
mkdir -p /etc/php7/mods-available/ | |
# need change php5 to php7 | |
cp fpm-build/sapi/fpm/php-fpm.conf /etc/php7/fpm/php-fpm.conf | |
cp /etc/php5/fpm/pool.d/www.conf /etc/php7/fpm/pool.d/www.conf | |
cp php.ini-production /etc/php7/fpm/php.ini | |
cd apache2-build | |
make install-modules | |
make install-modules | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment