當前位置:首頁 » 編程語言 » 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