当前位置:首页 » 编程语言 » 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返回this 发布:2025-10-20 08:28:16 浏览:593
制作脚本网站 发布:2025-10-20 08:17:34 浏览:888
python中的init方法 发布:2025-10-20 08:17:33 浏览:582
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:765
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:684
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:1013
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:255
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:114
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:806
python股票数据获取 发布:2025-10-20 07:39:44 浏览:713