更新时间:2023-11-15 22:58:04
您将需要可执行文件 cgi-fcgi
(在 libfcgi0ldbl $ c $的Debian部分中) c>包),那么您可以通过执行以下命令来做到这一点(这是一行,其中
\
转义了换行符,您应该可以将其粘贴到您的shell中,例如此):
You will need the executable cgi-fcgi
(in Debian part of the libfcgi0ldbl
package), then you can do it by executing this command (this is one line with \
escaping the newlines, you should be able to paste this to your shell like this):
SCRIPT_NAME=/file.php \
SCRIPT_FILENAME=/path/to/my/file.php \
REQUEST_METHOD=GET \
QUERY_STRING=param1=x\¶m2=y \
cgi-fcgi -bind -connect /var/run/php5-fpm-specific.sock
然后您将收到输出,因为它将被发送到HTTP服务器,因此它将包含HTTP标头,例如包含<?php echo时间为,date( H:i:s);
:
You will then receive the output, as it would be sent to the HTTP server, so it will include the HTTP headers, for example for a script containing <?php echo "The time is ", date("H:i:s");
:
Content-type: text/html
The time is 13:46:35
还有两个参数,但是这些是最重要的参数(请参阅它们如何映射到 $ _ SERVER
数组,这就是后台发生的事情):
There are a couple of more parameters but these are the most essential ones (see how they map to the $_SERVER
array, that's what's happening in the background):
SCRIPT_NAME
这是从HTTP端看到的脚本名称。在我的示例中,可以通过 http://localhost/file.php
SCRIPT_FILENAME访问文件
这是脚本的本地路径-这是HTTP服务器通常从URL确定的内容,在这里您需要自行指定 \&
SCRIPT_NAME
this is the script name as it is seen from the HTTP side. In my example the file could have been accessed via http://localhost/file.php
SCRIPT_FILENAME
this is the local path to the script -- it's what the HTTP server will usually determine from the URL, here you need to specify it yourselfQUERY_STRING
can be used if you also want to pass in something that would be after the ?
in a URL, be aware that we are in a shell, so you'd need to escape the ampersand like this: \&
另请参见: