当前位置:首页 » 编程语言 » yumphpmemcache

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

热点内容
java服务器代码 发布:2025-05-24 18:10:41 浏览:777
qt源码书吗 发布:2025-05-24 17:43:45 浏览:338
sql遍历表 发布:2025-05-24 17:38:51 浏览:450
x86x64体系探索及编程 发布:2025-05-24 17:15:06 浏览:130
局域网vpn服务器搭建 发布:2025-05-24 17:10:33 浏览:192
c语言算法复杂度 发布:2025-05-24 17:00:38 浏览:50
游戏脚本是什么 发布:2025-05-24 16:33:05 浏览:733
wifi代理服务器地址 发布:2025-05-24 16:25:20 浏览:866
安卓浏览器下载的文件在哪里找到 发布:2025-05-24 15:52:18 浏览:148
服务器所在主机的ip地址 发布:2025-05-24 15:45:52 浏览:983