LNMP環境搭建之php安裝
阿新 • • 發佈:2018-04-15
LNMP php安裝 和LAMP安裝PHP方法有差別,需要開啟php-fpm服務
下載php
cd /usr/local/src/
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
解壓源碼包
tar zxf php-5.6.30.tar.gz
創建用戶
useradd -s /sbin/nologin php-fpm
配置編譯參數
cd php-5.6.30 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --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 --with-pear --with-curl --with-openssl
編譯安裝php
make && make install
拷貝配置文件
cp php.ini-production /usr/local/php-fpm/etc/php.ini
vi /usr/local/php/etc/php-fpm.conf //寫入如下內容(參考
拷貝啟動腳本
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
加入開機啟動項
chkconfig --add php-fpm
chkconfig php-fpm on
啟動Php
service php-fpm start
查看進程
ps aux |grep php-fpm
LNMP環境搭建之php安裝