在centos6.5 上通过yum安装nginx和php-fpm
来源:互联网 发布:哪款理财软件好 编辑:程序博客网 时间:2024/06/08 07:11
在centos6.5 上安装php5.6
第一步:配置yum源
追加CentOS 6.5的epel及remi源。
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
以下是CentOS 7.0的源。
# yum install epel-release# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
第二步:
安装Nginx
输入下列命令
yum install nginx
如果你想在系统启动时自动运行nginx,输入下列命令:
第一次启动nginx,输入下列命令:
/etc/init.d/nginx start
第三步:
安装 php5.6 ,php-fpm
安装PHP5.6
yum源配置好了,下一步就安装PHP5.6。
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
用PHP命令查看版本。
# php --versionPHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31)Copyright (c) 1997-2014 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
单独安装php-fpm
安装php5.6版本下的php-fpm(不考虑版本情况下安装 输入下列命令:yum --enablerepo=remi install php php-fpm )
yum install --enablerepo=remi --enablerepo=remi-php56 php php-fpm
如果你想在系统启动时自动运行php-fpm,输入下列命令:
chkconfig --level 345 php-fpm on
PHP仅安装了核心模块,你很可能需要安装其他的模块,比如MySQL、 XML、 GD等等,你可以输入下列命令:
yum --enablerepo=remi install php-gd php-mysql php-mbstring php-xml php-mcrypt
第一次启动php-fpm,输入下列命令:
/etc/init.d/php-fpm restart
配置PHP-FPM和Nginx,让他们一起工作
vi /usr/local/nginx/conf/nginx.conf
server{ listen 80; server_name localhost; root /var/www/html;......location ~ \.php$ {如果这个scripts导致php文件File Not Found!#root html;
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME scripts$fastcgi_script_name; include fastcgi_params; }
}
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
第四步:
现在在/var/www/html目录下建立下列PHP文件index.php
文件内容如下:
<?php
phpinfo();
?>
访问:localhost/index.php
- 在centos6.5 上通过yum安装nginx和php-fpm
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- centos6 yum安装nginx、php-fpm
- centos6.3 yum安装nginx+mysql+php-fpm
- 在centos上通过yum安装PHP+Nginx+Mysql+phpmyadmin
- centos6通过yum安装nginx
- yum 安装php,mysql,php-fpm,nginx
- 在centos6上安装nginx, MySQL和PHP
- YUM安装nginx,mysql,php-fpm,redis
- yum 安装php-fpm+nginx+mysql教程
- nginx+PHP+PHP-FPM(FastCGI)在Ubuntu上的安装和配置
- nginx+PHP+PHP-FPM(FastCGI)在Ubuntu上的安装和配置
- nginx+PHP+PHP-FPM(FastCGI)在Ubuntu上的安装和配置
- c++ 静态引用动态库通过code blocks
- C++结构体的内存大小的总结
- 51nod 1084 矩阵取数问题 V2(dp)
- Linux进程的uid和euid
- 20170515_容器list的函数
- 在centos6.5 上通过yum安装nginx和php-fpm
- 关于注解support annotations 的小记
- python实现pow操作
- sql,只看某个下级的son节点,而不是孙子、曾孙子也看
- Servlet 生命周期
- Java高新技术之交通灯管理系统(java枚举,java线程池)
- AWK 输出重复的行 去掉重复的行
- 一个简单的桶排序
- 安卓bug及解决办法