yum的方式安装软件很方便,编译安装真的是太累了 一个新服务器要搞定所有东西,真是太麻烦 要不然就是安装apache,也很方便 php的很多功能都是模块化安装,比如连json的解析都需要额外安装 引用 今天安装赵容提供的监控源码,我在两台虚拟机上测试使用,环境是
yum的方式安装软件很方便,编译安装真的是太累了
一个新服务器要搞定所有东西,真是太麻烦
要不然就是安装apache,也很方便
php的很多功能都是模块化安装,比如连json的解析都需要额外安装
引用
今天安装赵容提供的监控源码,我在两台虚拟机上测试使用,环境是lamp,但php居然报PHP Fatal error: Call to undefined function json_encode()错误,网上找了下说是要安装json模块.
系统:centos 5.5
1.安装前准备
yum -y install php-devel php-pear gcc make
2.安装json
pear install pecl/json
或者
pecl install json
3.让php支持json
我的php是yum安装的,所以
cd /etc/php.d
echo "extension=json.so" > json.ini
重启apache
service httpd restart
如果有selinux,执行下面命令
chcon system_u:object_r:textrel_shlib_t /usr/lib/php/modules/json.so
或
chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/lib/php/modules/json.so
4.验证
php -m|grep json
json
可以看到php已经支持json了,现在可以重新去执行了php页面了.
上面来自:http://blog.slogra.com/post-272.html
也可以尝试“centos6 yum安装nginx、php-fpm”(未实践,个人备忘)
引用
使用Nginx官方源,Epel扩展库和remi源,remi源基于epel,必须先安装epel源,remi包含php-fpm,mysql-server5.5,如果只需要php-fpm可以单独安装php-fpm后禁用此源.
安装 Nginx 源:
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
安装EPEL源:
(64位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
(32位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
安装 REMI 源:
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
开启REMI,编辑 /etc/yum.repos.d/remi.repo
修改 enable=1
yum -y install nginx mysql-server php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator
linux可能会提示没有libmcrypt.so, 解决办法如下:
rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
yum clean all
yum makecache
yum install libmcrypt
2、设置nginx、php-fpm开机启动:
# chkconfig nginx on
# chkconfig php-fpm on
注:默认安装启动php-fpm时,出现如下错误:
正在启动 php-fpm:[28-Nov-2011 08:11:01] ERROR: [pool www] cannot get uid for user 'apache'
解决办法:
# vi /etc/php-fpm.d/www.conf
找到以下两行:
user = apache
group = apache
将其中的apache都改为nginx。
4、开启80端口(默认是关闭的):
# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# /etc/rc.d/init.d/iptables save
# /etc/init.d/iptables restart
5、修改nginx配置文件,启动nginx和php-fpm:
# vi /etc/nginx/conf.d/default.conf
更改网站的根目录,添加php默认文件:
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
修改到下代码,添加php支持:
# location ~ \.php$ {
# root your/web/path;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /your/web/path$fastcgi_script_name;
# include fastcgi_params;
#}
删除上面所有的#和其中一行(root这行),将/your/web/paht修改为web存放目录,如/var/www/html。启动nginx和php-fpm:
# service nginx start
# service php-fpm start
或者尝试这个(未实践,个人备忘):如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
原文地址:yum方式安装php-fpm, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Notepad++7.3.1
Easy-to-use and free code editor