centos6.5下面php和php-fpm的安裝和開啟opcache

來源:互聯網
上載者:User

標籤:style   blog   http   os   使用   io   strong   檔案   資料   

1 下載對應版本

http://php.net/get/php-5.5.15.tar.gz/from/a/mirror

2 rz命令擷取下載的資料包(如果沒有安裝,則yum install lrzsz安裝下) 然後上傳軟體

3 tar -zxvf php-5.5.15.tar.gz

4 cd /usr/local/ php-5.5.15

5 編譯 注意:這裡要加上php-fpm 這個是fastcgi

./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath --enable

-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --enable-opcache

報錯1:

Xml沒有安裝,按照提示安裝 重新編譯

報錯2:

mcrypt.h not found. Please reinstall libmcrypt”的解決方案

解決辦法一
1)安裝第三方yum源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
2)使用yum命令安裝
yum  install  php-mcrypt libmcrypt  libmcrypt-devel

 

如遇到其他問題,請訪問http://www.cnblogs.com/z-ping/archive/2012/06/18/2553929.html
這裡有一些問題解決方案關於安裝PHP問題解釋和解決方案

 

7 編譯安裝

make

make install

注意:如果裡面有報錯,按報錯提示安裝,然後重新運行

8 安裝下php-fpm

cp /usr/local/php-5.5.15/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

9 安裝下啟動指令碼 設定成可執行

 chmod a+x /etc/init.d/php-fpm

php-fpm啟動指令檔在最後面附件裡面:

10 配置nginx

Vim /usr/local/nginx/conf/nginx.conf

修改
user = www
group = www

如果www使用者不存在,那麼先添加www使用者
groupadd www
useradd -g www www

 

把 location /{

        root html;

        index index.php index.html;

}

這個的框去掉剩下

 

把支援php指令碼的注釋去掉,修改紅色部分

# pass the PHP scripts toFastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
  root html;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
  include fastcgi_params;
}

 

11 配置opcache 這個手動在php.ini裡面添加

把這句

zend_extension=/usr/local/php/modules/opcache.so

加到[opcache]裡面去

opcache.enable改為1

12 重啟nginx

service nginx restart

13 查看是否安裝成功 配置nginx使其支援php 查看phpinfo()

cd /usr/local/nginx/html

vim index.php 

<?php echo phpinfo(); ?>

地址欄上輸入

localhost

查看localhost

14 刪除php的安裝檔案,應該沒用了

Rm –rf /usr/local/php-5.5.15 –R

 

附件:

這個是php-fpm啟動指令碼,php不需要重新啟動,php-fpm可能需要,

以後可以用service php-fpmstart|stop|restart來管理了

附件地址:

http://files.cnblogs.com/wowotou/php-fpm_begin.zip

centos6.5下面php和php-fpm的安裝和開啟opcache

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.