標籤:php 編譯 nfs
編譯安裝php5.6.4
一、準備源碼包
650) this.width=650;" src="http://l51cto.qiniudn.com/php1.png" width="660" height="52" alt="php1.png" />
此處使用的是5.6.4版本,對於PHP5.3以上版本,為了連結MySQL資料庫,可以指定mysqlnd,這樣在本機就不需要先安裝MySQL或MySQL開發包了。mysqlnd從php
3開始可用,可以編譯時間綁定到它(而不用和具體的MySQL用戶端庫綁定形成依賴),但從PHP 5.4開始它就是預設設定了。
[[email protected] ~]# tar xf php-5.6.4.tar.xz [[email protected] ~]# cd php-5.6.4 [[email protected] php-5.6.4]# ./configure --prefix=/usr/local/php--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd--with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir--with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml--enable-sockets --with-mcrypt--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2--enable-maintainer-zts --enable-fpm[[email protected] php-5.6.4]# make[[email protected] php-5.6.4]# make install
編譯時間會比較長
二、配置php
[[email protected] php-5.6.4]# cp php.ini-production /etc/php.ini //為php提供設定檔
為php-fpm提供SysV init指令碼,並將其添加至服務列表,並指明安裝路徑、php-fpm程式路徑、設定檔路徑以及pid檔案路徑
[[email protected] php-5.6.4]# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm[[email protected] php-5.6.4]# chmod +x /etc/rc.d/init.d/php-fpm[[email protected] php-5.6.4]# chkconfig --add php-fpm[[email protected] php-5.6.4]# chkconfig php-fpm on
650) this.width=650;" src="http://l51cto.qiniudn.com/php2.png" width="660" height="112" alt="php2.png" />
為php-fpm提供設定檔:
[[email protected] php-5.6.4]# cp/usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
編輯php-fpm的設定檔:
[[email protected] php-5.6.4]# vim /usr/local/php/etc/php-fpm.conf
配置fpm的相關選項為你所需要的值,並啟用pid檔案,修改監聽IP地址連接埠(如下最後一行):
pm.max_children = 50pm.start_servers = 5pm.min_spare_servers = 2pm.max_spare_servers = 8pid = /usr/local/php/var/run/php-fpm.pid
650) this.width=650;" src="http://l51cto.qiniudn.com/php3.png" width="660" height="46" alt="php3.png" />
現在可以測試php-fpm能否啟動了
650) this.width=650;" src="http://l51cto.qiniudn.com/php4.png" width="660" height="32" alt="php4.png" />
啟用成功
NFS檔案系統
實現程式nfs-utils
[[email protected] ~]# yum install -y nfs-utils
啟動服務指令碼
[[email protected] ~]# service nfs start
查看啟動後連接埠
[[email protected] ~]# rpcinfo –p
650) this.width=650;" src="http://l51cto.qiniudn.com/php5.png" width="660" height="295" alt="php5.png" />
nfs使用2049連接埠,mountd使用隨機連接埠
配置NFS
編輯/etc/exports檔案,每一行為一個檔案系統
650) this.width=650;" src="http://l51cto.qiniudn.com/php9.png" width="660" height="37" border="0" hspace="0" vspace="0" title="" style="width:660px;height:37px;" alt="php9.png" />
每一行的第一個IP為http主機第二個ip為php主機,分別為兩台伺服器授權,rw表示讀寫權限,no_root_squash表示掛載
此檔案系統的用戶端具有root許可權,以便之後掛載訪問
此處我們為之後的網站wordpress和phpMyAdmin建立的兩個目錄
[[email protected] wp]# mkdir /web/vhosts/{wp,pma}
重啟服務
650) this.width=650;" src="http://l51cto.qiniudn.com/php7.png" width="660" height="202" alt="php7.png" />
showmount –e 可以查看當前已掛載的檔案系統
650) this.width=650;" src="http://l51cto.qiniudn.com/php8.png" width="660" height="126" alt="php8.png" />
本文出自 “linux學習之路” 部落格,請務必保留此出處http://linuxu.blog.51cto.com/9471357/1597006
LAMP+NFS之編譯安裝php與NFS檔案系統