LAMP+NFS之編譯安裝php與NFS檔案系統

來源:互聯網
上載者:User

標籤: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檔案系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.