yumphpmemcache
發布時間: 2025-05-24 14:08:07
㈠ 用yum安裝php-fpm提示There are no enabled repos.
Nginx 本身就不用介紹了,目前使用 FastCGI 是最流行的模式.現在不少網站使用.我來介紹一個簡單的安裝方法.
先要使用第三方的源,默認的源是不存在最新的 php 的,需要 php 5.3.3 以上才有 php-fpm,所以一定要安裝這些源..
配置最新 PHP 的源
如果是 CentOS 6 和 Red Hat (RHEL) 6 的 Remi 源
rpm-Uvhhttp://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm-Uvhhttp://rpms.famillecollet.com/enterprise/remi-release-6.rpm
如果是 CentOS 5 和 Red Hat (RHEL) 5 的 Remi 源
rpm-Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm-Uvhhttp://rpms.famillecollet.com/enterprise/remi-release-5.rpm
配置 Nginx 的源
我們需要建一個新的源文件,編輯 /etc/yum.repos.d/nginx.repo 就可以了.加入如下內容
[nginx]
name=nginxrepo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
安裝最新的 Nginx 和 PHP(php-fpm)
安裝最新的 Nginx 和 PHP .還有支持啟動 FastCGI 的 php-fpm 的功能.其它都是 PHP 的一些模塊了.
yum--enablerepo=remiinstallnginxphpphp-fpmphp-common
php-pearphp-pdophp-mysqlphp-pgsqlphp-pecl-memcachephp-gd
php-mbstringphp-mcryptphp-xml
安裝 MYSql 也需要使用這個的源才行
yum--enablerepo=remiinstallmysqlmysql-server
配置 Nginx 和 PHP-FPM
在 Nginx 加,給這些下面的注掉的內容打開,讓 php 的文件支持使用 fastcgi 來通信就行了.
location~.php${
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/usr/share/nginx/html$fastcgi_script_name;
includefastcgi_params;
}
測試 Nginx 和 PHP-FPM
我們需要確認 fastcgi 是否能正常的使用,所以需要在,上面的 /usr/share/nginx/html 中加入 phpinfo.php 的測試文件.
<?php
phpinfo();
?>
這時只要打開 url 來測試這個 phpinfo.php 文件是否能正常的顯示就行了.
啟動和永久啟動 Nginx 和 PHP-FPM
我們一定不想下次 Nginx 和 PHP-FPM 在也啟動不了啦,所以我們需要加入啟動中去.讓系統啟動後就能自動啟動這些.
servicenginxstart
servicephp-fpmstart
chkconfig--addnginx
chkconfig--levels235nginxon
chkconfig--addphp-fpm
chkconfig--levels235php-fpmon
熱點內容