Компіляція PHP 5.2.17 для Debian7 (wheezy) x86_64 – fastcgi режим

27 Вересня, 2013 | Теґи: , , , ,

Стадія 1. Підготовка системи.

ccd /usr/local/src/
rm -rf *
mkdir -p /opt/php/5.2/etc/php.d
apt-get -y install php5-dev libxml2-dev libmhash-dev libcurl4-openssl-dev libbz2-dev libmagickwand-dev libpng12-dev libfreetype6-dev libgmp-dev libc-client2007e-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev make build-essential libmcrypt-dev libmysqld-dev libmagic-dev unzip
cd /usr/lib/x86_64-linux-gnu/
cp libjpeg.* ..
cp libpng.* ..
cp libmysqlclient.* ..
cp libkrb5.* ..
cp libssl.* ..


Стадія 2. Компіляція самого PHP.

cd /usr/local/src/
wget http://museum.php.net/php5/php-5.2.17.tar.bz2
tar xjf php-5.2.17.tar.bz2
cd php-5.2.17
### https://bugs.php.net/bug.php?id=50990 
replace "__GMP_BITS_PER_MP_LIMB" "GMP_LIMB_BITS" -- ext/gmp/gmp.c
### https://bugs.php.net/bug.php?id=54736
wget https://deusblog.org.ua/files/patches/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch.patch.txt
patch -p1 < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch.patch.txt
./configure --prefix=/opt/php/5.2 --exec-prefix=/opt/php/5.2 --sysconfdir=/etc --with-libdir=/usr/lib --disable-rpath --with-config-file-path=/opt/php/5.2/etc --with-config-file-scan-dir=/opt/php/5.2/etc/php.d --disable-all --enable-fastcgi --enable-gd-native-ttf --with-bz2 --enable-calendar --enable-ctype --with-curl --with-gd --with-jpeg-dir=/usr/lib/i386-linux-gnu --with-freetype-dir=/usr --with-gmp --enable-hash --with-iconv --enable-json --enable-libxml --enable-mbstring --with-mcrypt --with-mhash --with-openssl --with-pcre-regex --enable-pdo --enable-posix --with-pspell --enable-session --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-sysvmsg --enable-spl --enable-tokenizer --enable-wddx --enable-xml --enable-xmlreader --with-xmlrpc --enable-xmlwriter --with-xsl --enable-exif --enable-ftp --enable-dom --enable-bcmath --with-gettext --with-mysql --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysqli --with-libdir=lib --with-zlib
make
make install

Стадія 3. Установка додаткових модулів.
Тут можна встановлювати вибірково, залежно від того, що потрібно для роботи проекту.

##pdo_mysql##
cd /usr/local/src/
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar xzf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=pdo_mysql.so" > /opt/php/5.2/etc/php.d/pdo_mysql.ini

##zip##
cd /usr/local/src/
wget http://pecl.php.net/get/zip-1.10.2.tgz
tar xzf zip-1.10.2.tgz
cd zip-1.10.2/
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=zip.so" > /opt/php/5.2/etc/php.d/zip.ini

##imagick##
cd /usr/local/src/
wget http://pecl.php.net/get/imagick-3.0.1.tgz
tar xzf imagick-3.0.1.tgz
cd imagick-3.0.1/
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=imagick.so" > /opt/php/5.2/etc/php.d/imagick.ini

##pnctl##
cd /usr/local/src/php-5.2.17/ext/pcntl
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=pcntl.so" > /opt/php/5.2/etc/php.d/pcntl.ini

##dba##
cd /usr/local/src/php-5.2.17/ext/dba
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=dba.so" > /opt/php/5.2/etc/php.d/dba.ini

##filter##
cd /usr/local/src/php-5.2.17/ext/filter
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=filter.so" > /opt/php/5.2/etc/php.d/filter.ini

##eAccelerator##
cd /usr/local/src/
wget -O ea.zip https://github.com/eaccelerator/eaccelerator/zipball/master
unzip ea.zip
cd eaccelerator*
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo 'extension = "eaccelerator.so"
eaccelerator.enable="1"
eaccelerator.shm_size="0"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="1M"
eaccelerator.shm_ttl="180"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="1"
eaccelerator.compress="1"
eaccelerator.compress_level="9"' > /opt/php/5.2/etc/php.d/eaccelerator.ini

##htscanner##
cd /usr/local/src/
wget http://pecl.php.net/get/htscanner-1.0.1.tgz
tar xzf htscanner-1.0.1.tgz
cd htscanner-1.0.1/
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=htscanner.so" > /opt/php/5.2/etc/php.d/htscanner.ini

##sysvsem##
cd /usr/local/src/php-5.2.17/ext/sysvsem/
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=sysvsem.so" > /opt/php/5.2/etc/php.d/sysvsem.ini

##sysvshm##
cd /usr/local/src/php-5.2.17/ext/sysvshm
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=sysvshm.so" > /opt/php/5.2/etc/php.d/sysvshm.ini

##sqlite (sqlite2)##
cd /usr/local/src/php-5.2.17/ext/sqlite
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=sqlite.so" > /opt/php/5.2/etc/php.d/sqlite.ini

##pdo_sqlite##
cd /usr/local/src/php-5.2.17/ext/pdo_sqlite
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config --enable-sqlite-utf8
make && make install
echo "extension=pdo_sqlite.so" > /opt/php/5.2/etc/php.d/pdo_sqlite.ini

##tidy##
cd /usr/local/src/php-5.2.17/ext/tidy
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config
make && make install
echo "extension=tidy.so" > /opt/php/5.2/etc/php.d/tidy.ini

##imap##
cd /usr/local/src/php-5.2.17/ext/imap
/opt/php/5.2/bin/phpize
./configure --with-php-config=/opt/php/5.2/bin/php-config --with-imap --with-imap-ssl=/usr --with-kerberos=/usr
make && make install
echo "extension=imap.so" > /opt/php/5.2/etc/php.d/imap.ini

##ionCube## 
##download from http://www.ioncube.com/loaders.php - Linux (x86_84)
cd /usr/local/src/
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.bz2
tar xjf ioncube_loaders_lin_x86-64.tar.bz2
cd ioncube/
chown root:root ioncube_loader_lin_5.2.so
cp ioncube_loader_lin_5.2.so /opt/php/5.2/lib/php/extensions/no-debug-non-zts-20060613/
echo "zend_extension=/opt/php/5.2/lib/php/extensions/no-debug-non-zts-20060613/ioncube_loader_lin_5.2.so" > /opt/php/5.2/etc/php.d/ioncube.ini

Zend Optimizer встановлюється вручну через політику сайту (не видається лінк без логіну на сайт).

##Zend Optimizer##
#download from http://www.zend.com/en/products/guard/downloads-prev - Linux - Zend Optimizer (Runtime for PHP 5.2 and earlier) 	3.3.9 (64 bit)
cd /usr/local/src/
cp /root/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz .
tar xzf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
cd ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/
cp ZendOptimizer.so /opt/php/5.2/lib/php/extensions/no-debug-non-zts-20060613/
echo "zend_extension=/opt/php/5.2/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer.so" > /opt/php/5.2/etc/php.d/zend.ini

Власне, все відразу (без ZendOptimizer) у вигляді скрипта можна взяти тут.

Ще немає коментарів.