วิธี Compile PHP จาก Source ด้วย Ubuntu 14.04
วิธี Compile PHP จาก Source code ( https://github.com/php/php-src) ด้วย Ubuntu 14.04Download code PHP
git clone https://github.com/php/php-src.git
Install dependency package ที่ใช้ในการ Compile
ติดตั้ง header file ที่ใช้ในการ Compile ด้วยคำสั่งapt-get build-dep php5 php5-cgi php5-cli php5-fpm php5-curl php5-gd php5-gmp php5-json php5-mysql php5-pspell php5-recode php5-mcrypt php5-memcached php5-imagick
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
Compile PHP
ไปที่ folder sourcecode ที่เราโหลดมาแล้วสั่งดังนี้
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
./buildconf
./configure \
--prefix=$HOME/php/usr \
--with-config-file-path=$HOME/php/usr/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-mysqli=/usr \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config
make
make install
รอสักครู่เพื่อทำการ compile sourcecode เมื่อเรา compile และติดตั้งไปยัง path ที่เรากำหนด (--prefix=$HOME/php/usr) เรียบร้อยแล้ว ก็มาลองรันตัว php command line กันดู
ให้ไปที่
cd ~/php/usr/bin/
./php -v
ก็จะได้ PHP ตัวล่าสุดมาแล้วครับ
เป็นอันเสร็จสิ้นการ Compile PHP เบื้องต้นครับผม
Ref:
https://wiki.php.net/phpng
0 comments: