LNMP之PHP安裝操作步驟

piny發表於2021-09-09

=======> LNMP 之 PHP安裝操作步驟 1、==>備份預設源==>下載mirrors.163.com源==>yum安裝epel源

wget -O /etc/yum.repos.d/CentOS-Base.repo
yum install epel-release -y

====>檢視依賴庫
rpm -aq pcre pcre-devel openssl openssl-devel zlib-devel
libxml2-devel libjpeg-turbo-devel libpng-devel libcurl-devel libxslt-devel
freetype-devel gd-devel mhash mhash-devel mcrypt libmcrypt-devel

yum install pcre pcre-devel openssl openssl-devel zlib-devel
libxml2-devel libjpeg-turbo-devel libpng-devel libcurl-devel libxslt-devel
freetype-devel gd-devel mhash mhash-devel mcrypt libmcrypt-devel -y
 
=======>mhash、mhash-devel加密擴充套件庫、mcrypt加密擴充套件庫
    mhash mhash-devel mcrypt libmcrypt-devel

2、====>安裝 libiconv-devel庫,需要第三方;
mkdir /home/tools/ -p
cd /home/tools/
wget
tar zxf libiconv-1.14.tar.gz  
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
cd ../

============LNMP==============================================
3、====>配合nginx安裝PHP-5.3.27引數   ===> --with-mysql=mysqlnd
cd /home/tools
rz php-5.3.27.tar.gz
tar zxf php-5.3.27.tar.gz
cd php-5.3.27/
./configure
--prefix=/application/php-5.3.27
--with-mysql=/application/mysql
--with-iconv-dir=/usr/local/libiconv
--with-freetype-dir
--with-jpeg-dir
--with-png-dir
--with-zlib
--with-libxml-dir=/usr
--enable-xml
--disable-rpath
--enable-safe-mode
--enable-bcmath
--enable-shmop
--enable-sysvsem
--enable-inline-optimization
--with-curl
--with-curlwrappers
--enable-mbregex
--enable-fpm
--enable-mbstring
--with-mcrypt
--with-gd
--enable-gd-native-ttf
--with-openssl
--with-mhash
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-zip
--enable-soap
--enable-short-tags
--enable-zend-multibyte
--enable-static
--with-xsl
--with-fpm-user=nginx
--with-fpm-group=nginx
--enable-ftp

=================================================================
==========先執行以下一種再make否則會報錯=========================
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar

=========================
echo "/application/mysql/lib" >>/etc/ld.so.conf
ldconfig

=================================================================
make && make install

ln -s /application/php-5.3.27/ /application/php
cp php-5.3.27/php.ini-production /application/php/lib/php.ini

=====>配置檔案
[root@Lnmp tools]# ll php-5.3.27/php.ini*
-rw-r--r-- 1 101 101 69606 Jul 11  2013 php-5.3.27/php.ini-development  ==>開發環境
-rw-r--r-- 1 101 101 69627 Jul 11  2013 php-5.3.27/php.ini-production   ==>生產環境
=====>上傳或修改配置檔案
rz php-fpm.conf.5.3.27-cxybase
mv php-fpm.conf.5.3.27-cxybase /application/php/etc/php-fpm.conf
mkdir -p /app/logs

/application/php/sbin/php-fpm -t          ====>檢查語法
/application/php/sbin/php-fpm             ====>啟動PHP
netstat -lntup|grep php-fpm                 ====>檢視服務程式
ps -ef|grep php-fpm|grep -v grep

=================================================================
開機自啟動:
/application/php/sbin/php-fpm
/application/nginx/sbin/nginx

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/3034/viewspace-2801389/,如需轉載,請註明出處,否則將追究法律責任。

相關文章