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

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

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

cd /usr/local/src/
rm -rf *
mkdir -p /opt/php/5.3/etc/php.d
cd /usr
ln -s lib lib64
apt-get -y install php5-dev libxml2-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


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

cd /usr/local/src/
wget -O php-5.3.27.tar.bz2 http://ua1.php.net/get/php-5.3.27.tar.bz2/from/this/mirror
tar xjf php-5.3.27.tar.bz2
cd php-5.3.27/
./configure --prefix=/opt/php/5.3 --exec-prefix=/opt/php/5.3 --sysconfdir=/etc --with-libdir=/usr/lib64 --disable-rpath --with-config-file-path=/opt/php/5.3/etc --with-config-file-scan-dir=/opt/php/5.3/etc/php.d --disable-all --disable-fpm --enable-gd-native-ttf --with-bz2 --enable-calendar --enable-ctype --with-curl --with-gd --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr --with-gmp --enable-hash --with-iconv --enable-json --enable-libxml --with-imap --with-imap-ssl=/usr --with-kerberos --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-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-libdir=lib64 --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-zlib --enable-filter --enable-cgi --with-sqlite3 --with-pdo-sqlite --enable-sqlite-utf8 
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.3/bin/phpize
./configure --with-php-config=/opt/php/5.3/bin/php-config
make && make install
echo "extension=pdo_mysql.so" > /opt/php/5.3/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.3/bin/phpize
./configure --with-php-config=/opt/php/5.3/bin/php-config
make && make install
echo "extension=zip.so" > /opt/php/5.3/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.3/bin/phpize
./configure --with-php-config=/opt/php/5.3/bin/php-config
make && make install
echo "extension=imagick.so" > /opt/php/5.3/etc/php.d/imagick.ini

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

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

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

##dba##
cd /usr/local/src/php-5.3.27/ext/dba
/opt/php/5.3/bin/phpize
./configure --with-php-config=/opt/php/5.3/bin/php-config
make && make install
echo "extension=dba.so" > /opt/php/5.3/etc/php.d/dba.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.3/bin/phpize
./configure --with-php-config=/opt/php/5.3/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.3/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.3/bin/phpize
./configure --with-php-config=/opt/php/5.3/bin/php-config
make && make install
echo "extension=htscanner.so" > /opt/php/5.3/etc/php.d/htscanner.ini

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

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

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

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


##ionCube## 
##download from http://www.ioncube.com/loaders.php - Linux (x86_64)
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.3.so
cp ioncube_loader_lin_5.3.so /opt/php/5.3/lib/php/extensions/no-debug-non-zts-20090626/
echo "zend_extension=/opt/php/5.3/lib/php/extensions/no-debug-non-zts-20090626/ioncube_loader_lin_5.3.so" > /opt/php/5.3/etc/php.d/ioncube.ini

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

##ZendGuardLoader##
#download from http://www.zend.com/en/products/guard/downloads - Linux - Zend Guard Loader (Runtime for PHP 5.3) 64 bit
cd /usr/local/src/
tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
cd ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/
chmod 755 ZendGuardLoader.so
chown root:root ZendGuardLoader.so
cp ZendGuardLoader.so /opt/php/5.3/lib/php/extensions/no-debug-non-zts-20090626/
echo "zend_extension=/opt/php/5.3/lib/php/extensions/no-debug-non-zts-20090626/ZendGuardLoader.so" > /opt/php/5.3/etc/php.d/zend.ini

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

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