nginx+php(fastcgi)+上传进度条的安装与配置

php-fpm详情见:http://syre.blogbus.com/logs/20092011.html
nginx+fastcgi见:http://www.kuqin.com/web/20080829/15611.html
php-fpm下载:http://php-fpm.anight.org/download.html
nginx介绍:http://www.ibm.com/developerworks/cn/web/wa-lo-nginx/

下载:http://sysoev.ru/nginx/nginx-0.7.30.tar.gz
下载:http://php-fpm.anight.org/downloads/head/php-5.2.8-fpm-0.5.10.diff.gz
下载:http://wiki.nginx.org/File:Nginx_uploadprogress_module-0.5.tar.gz
(1)装nginx
yum install pcre-devel
解压nginx-0.7.30.tar.gz与Nginx_uploadprogress_module-0.5.tar.gz(解压至/data/soft/nginx_uploadprogress_module)
./configure –prefix=/data/sys/nginx –user=nobody –group=nobody
–with-http_stub_status_module  –add-module=/data/soft/nginx_uploadprogress_module
make
make install
阅读更多

simplexml_load_file与json_encode的编码问题

1.json_encode目前只支持utf-8编码,因此如果json_encode的内容有双字节(如汉字)的字符必须先转为utf-8,否则json_encode出来的内容将为空,如:

$std = new stdclass();
$std->name=”中国”;
$std->eng = ‘china”;
$t = json_encode($std);
//在页面采用gbk情况下$t的值将是{“name”:””,eng:”china”},name属性值被清空,必须先对name进行转码,json_encode之前增加一步$std->name=iconv(‘gbk’,’utf-8′,$std->name);
//在页面采用utf-8情况下$t的值将是{“name”:”中国”,eng:”china”}

2simplexml_load_file的编码问题
在utf-8情况下是正常的,但在gbk环境下发现simplexml_load_file(“xml文件”)时,不管xml文件是gbk还是utf-8编码,simplexml_load_file出来的节点相关内容都是utf-8属性,所以如果页面采用非utf-8编码时必须进行iconv转码。