編譯、安裝
在編譯的過程中會不斷提示我們需要安裝其他軟體來支援。我們一一安裝。[root@server1 ~]# ls
php-5.6.35.tar.bz2
[root@server1 ~]# tar jxf php-5.6.35.tar.bz2 (安裝包解壓)
[root@server1 ~]# cd php-5.6.35
[root@server1 php-5.6.35]# ./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-openssl
--with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir
--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp
--with-gettext --with-pear --enable-mysqlnd --with-mysql=mysqlnd
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
--enable-inline-optimization --enable-soap --enable-ftp
--enable-sockets --enable-mbstring --enable-fpm
--with-fpm-user=nginx --with-fpm-group=nginx
--with-mcrypt --with-mhash
配置[root@server1 php-5.6.35]# yum install libxml2-devel -y
[root@server1 php-5.6.35]# yum install openssl-devel -y
[root@server1 php-5.6.35]# yum install libcurl-devel -y
[root@server1 php-5.6.35]# yum whatprovides */jpeglib.h(檢視合適的軟體)
[root@server1 php-5.6.35]# yum install libjpeg-turbo-devel-1.2.1-1.el6.x86_64 -y
[root@server1 php-5.6.35]# yum whatprovides */png.h
[root@server1 php-5.6.35]# yum install libpng-devel-1.2.49-1.el6_2.x86_64
[root@server1 php-5.6.35]# yum install -y freetype-devel
[root@server1 php-5.6.35]# yum whatprovides */png.h
[root@server1 php-5.6.35]# yum whatprovides */gmp.h
[root@server1 php-5.6.35]# yum install gmp-devel-4.3.1-7.el6_2.2.x86_64
[root@server1 ~]# ls
libmcrypt-devel-2.5.8-9.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm
[root@server1 ~]# yum install libmcrypt-* -y
[root@server1 php-5.6.35]# yum install -y net-snmp-devel
[root@server1 php-5.6.35]# ./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-openssl
--with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir
--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp
--with-gettext --with-pear --enable-mysqlnd --with-mysql=mysqlnd
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
--enable-inline-optimization --enable-soap --enable-ftp
--enable-sockets --enable-mbstring --enable-fpm
--with-fpm-user=nginx --with-fpm-group=nginx
--with-mcrypt --with-mhash
(再次編譯,無報錯成功)
[root@server1 php-5.6.35]# make && make install
開啟服務成功[root@server1 php-5.6.35]# cd /usr/local/lnmp/
[root@server1 lnmp]# cd php/
[root@server1 php]# cd etc/
[root@server1 etc]# ls
pear.conf php-fpm.conf.default
[root@server1 etc]# cp php-fpm.conf.default php-fpm.conf
[root@server1 etc]# vim php-fpm.conf(編輯配置檔案)
25 pid = run/php-fpm.pid
[root@server1 ~]# cd php-5.6.35
[root@server1 php-5.6.35]# cp php.ini-production /usr/local/lnmp/php/etc/php.ini
[root@server1 php-5.6.35]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php.ini
[root@server1 etc]# vim php.ini
936 date.timezone =asia/shanghai(修改時區)
[root@server1 etc]# cd
[root@server1 ~]# find * -name init.d.php-fpm(查詢此檔案所在)
php-5.6.35/sapi/fpm/init.d.php-fpm
[root@server1 ~]# cd php-5.6.35/sapi/fpm/
[root@server1 fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@server1 fpm]# chmod +x /etc/init.d/php-fpm (新增執行許可權)
[root@server1 fpm]# /etc/init.d/php-fpm start
starting php-fpm [20-feb-2019 15:24:42] error: [pool www] cannot get uid for user 'nginx'(報錯,沒有nginx使用者)
[root@server1 fpm]# useradd nginx(建立所需使用者)
LNMP PHP的編譯安裝
按照lnmp的順序,我們應該先編譯mysql,再編譯php,最後編譯nginx,因為lnmp的mysql和lamp的mysql編譯一樣,所以我們就略過,不再闡述了具體可以看這個鏈結 另外補充乙個mysql的原始碼 還需要注意乙個問題,那就是我們單獨配置lnmp的思路是不對的,我們的思路應該也必須是l...
原始碼安裝 mysql 原始碼安裝 mysql
yum y install ncurses devel gcc bzip2 bison 安裝解壓命令 安裝命令 wget http 複製的鏈結.解壓命令 tar xf cmake檔案.tar 編譯工具cmake安裝 cmake命令版本 2.8以上 將資料夾放到指定目錄整理 mv usr local ...
yum安裝與原始碼安裝比較
yum安裝與原始碼安裝比較 一 yum安裝和原始碼安裝,方式的不同 二 yum安裝和原始碼安裝,優缺點分析 1 yum安裝的優缺點 yum安裝的優點,做運維的都很清楚,安裝東西,方便快捷,特別是不用考慮包依賴。yum安裝的缺點,安裝過程,人為無法干預,不能按需,安裝。源裡面有什麼就安裝什麼,安裝的版...