Aug 22

fast-cgi的文件分布情况 不指定

hqlulu , 00:30 , 技术分享 » PHP , 评论(0) , 引用(0) , 阅读(288) , Via 本站原创 | |
fast-cgi是可以使用本地服务器A,调用远程B服务器的php的fast-cgi进程,一直还没相通是把A的本地文件传输给B,B执行然后返回,还是A通知B执行某个文件?

还是自己做个测试就知道:

在[B5]上安装PHP的fastcgi,在[A5]上安装的是Nginx,加fastcgi设置

#部分设置
root /Data/webapps/;

location ~ \.php$ {
    fastcgi_pass   192.168.1.5:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /Data/webapps/pic.zcom.com$fastcgi_script_name;
    include        fastcgi_params;
}


文件都分布一下:

//file @A6 //

/Data/webapps/index.htm
A6 OK

/Data/webapps/test.aslibra.com/index.php

<pre><?phpinfo();?>


//file @B5 //

/Data/webapps/index.htm
B5 OK

/Data/webapps/test.aslibra.com/index.php

<pre><? print_r($_SERVER); ?>


访问两个地址:
http://test.aslibra.com/index.htm
http://test.aslibra.com/index.php

结果:

A6 OK
(文件在A6)

[SCRIPT_FILENAME] => /Data/webapps/test.aslibra.com/index.php
[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /index.php
[DOCUMENT_URI] => /index.php
[DOCUMENT_ROOT] => /Data/webapps
[SERVER_SOFTWARE] => nginx/0.6.31
[SERVER_ADDR] => X.X.X.6
[PHP_SELF] => /index.php
(文件在B5,但注意,显示的SERVER_ADDR信息是A6的IP,对外是不知道是B5在运行的)


也就是说:
文件使用的是对方服务器的文件,PHP文件的路径是在主服务器设置的。

有说明是要修改 cgi.fix_pathinfo=1 ,但文件说明是默认就是1了,所以估计不用修改

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix it's paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

修改成 cgi.fix_pathinfo=0 也还没发现啥不同,不知道会发生什么现象

另外,如果指定的php文件不存在,会有这样的错误:
No input file specified.
Tags: , ,
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]