UbuntuでPHPをコンパイルする

1.依存パッケージのインストール
#sudo apt-get install libjpeg-dev
#sudo apt-get install libxml2-dev
#sudo apt-get -y install libjpeg-dev
#sudo apt-get install libmcrypt-dev
#sudo apt-get install libpng12-dev
#sudo apt-get -y install libfreetype6-dev
#sudo apt-get install curl libcurl3 libcurl3-dev

2.コンパイル
#sudo ./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php –enable-fpm –with-fpm-user=php-fpm –with-fpm-group=php-fpm –with-mysql=mysqlnd –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –with-iconv-dir –with-zlib-dir –with-mcrypt –enable-soap –enable-gd-native-ttf –enable-ftp –enable-mbstring –enable-exif –disable-ipv6 –with-pear –with-curl –enable-bcmath –enable-mbstring –enable-sockets –with-gd –with-libxml-dir=/usr/local –with-gettext

3.php.iniの修正
#sudo cp php.ini-development /usr/local/php/php.ini
#sudo vim /usr/local/php/php.ini
data.timezone = PRC

4.php-fpmの修正
#cd /usr/local/php/etc
#sudo cp php-fpm.conf.default php-fpm.conf
#vim php-fpm.conf
#pidとエラーログの有効
pid = run/php-fpm.pid
error_log = log/php-fpm.log
user = ttuser
group = ttuser

5.php起動コマンド
#sudo cp -r /usr/local/src/php-5.6.26/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#sudo mkdir -p /usr/local/php/etc/fpm.d
#sudo chmod +x /etc/init.d/php-fpm

6.php-fpmの起動
#sudo /etc/init.d/php-fpm (start|stop|force-quit|restart|reload|status)

php-fpm自動起動
#sudo apt-get install sysv-rc-conf
#sudo sysv-rc-conf php-fpm on

Server

Posted by arkgame