大约 90 秒后,我在 apache 错误日志中看到此错误。我假设我需要增加 PHP 中的一项设置,但我不确定要更改哪一项。
我可以增加一项设置来清除此错误吗?
我有一个简单的脚本 cpuinfo.sh 可以工作并且可执行。
我收到错误
*224 FastCGI 在 stderr 中发送:“无法获取脚本名称,DOCUMENT_ROOT 和 SCRIPT_NAME(或 SCRIPT_FILENAME)是否设置以及脚本可执行吗?” 从上游读取响应头时,客户端:86.44.146.39,服务器:staging.example.com,请求:“GET /cpuinfo.sh HTTP/1.1”,上游:“fastcgi://unix:/var/run/fcgiwrap.套接字:”,主机:“staging.example.com”
nginx 设置是
location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {
gzip off;
autoindex on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/balance/balance-infosystems-web/scripts/;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Run Code Online (Sandbox Code Playgroud)
我期待 fcgiwrap 执行
/home/balance/balance-infosystems-web/scripts/cpuinfo.sh
Run Code Online (Sandbox Code Playgroud)
我对脚本路径进行了硬编码以进行调试,但仍然遇到相同的错误。
location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {
gzip off;
autoindex on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/balance/balance-infosystems-web/scripts/;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /home/balance/balance-infosystems-web/scripts/cpuinfo.sh;
}
Run Code Online (Sandbox Code Playgroud)
需要更改 nginx 服务器配置中的哪些内容才能正确执行脚本?
我研究了较旧的问题
你如何增加 MAMP / MAMP Pro 上的 apache fastCGI 超时?
但我的配置完全不同,因为我使用的是 MAMP Pro 4 并且我有多个 PHP 版本正在运行
我尝试编辑 MAMP/fcg-bin/phpx.xxfcgi 并添加 -idle-timeout 3600,因为它看起来更干净
#!/bin/sh
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=200
exec /Applications/MAMP/bin/php/php5.4.45/bin/php-cgi -c "/Library/Application Support/appsolute/MAMP PRO/conf/php5.4.45.ini" -idle-timeout 3600
Run Code Online (Sandbox Code Playgroud)
并且
#!/bin/sh
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=200
exec /Applications/MAMP/bin/php/php5.6.30/bin/php-cgi -c "/Library/Application Support/appsolute/MAMP PRO/conf/php5.6.30.ini" -idle-timeout 3600
Run Code Online (Sandbox Code Playgroud)
但它似乎没有任何影响我仍然得到同样的错误
FastCGI:与服务器“/Applications/MAMP/fcgi-bin/php5.6.30.fcgi”通信中止:空闲超时(30 秒)
我也尝试编辑 apache > httpd.conf
#MAMP_FastCgiServer_MAMP
FastCgiServer /Applications/MAMP/fcgi-bin/php5.4.45.fcgi -idle-timeout 2400
FastCgiServer /Applications/MAMP/fcgi-bin/php5.6.30.fcgi -idle-timeout 3600
Run Code Online (Sandbox Code Playgroud)
在这种情况下,Apache 不会启动
当尝试运行“wfastcgi-enable”在 IIS 上部署我的 Django 代码时,它显示以下错误:
ERROR ( message:New application object missing required attributes. Cannot add duplicate collection entry of type 'application' with combined key attributes 'fullPath, arguments' respectively set to 'C:\Users\paritosh\AppData\Local\Programs\Python\Python39\python.exe, C:\Users\paritosh\AppData\Local\Programs\Python\Python39\lib\site-packages\wfastcgi.py'
. )
An error occurred running the command:
['C:\\Windows\\system32\\inetsrv\\appcmd.exe', 'set', 'config', '/section:system.webServer/fastCGI', "/+[fullPath='C:\\Users\\paritosh\\AppData\\Local\\Programs\\Python\\Python39\\python.exe', arguments='C:\\Users\\paritosh\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\wfastcgi.py', signalBeforeTerminateSeconds='30']"]
Ensure your user has sufficient privileges and try again.
Run Code Online (Sandbox Code Playgroud)
我也尝试过在管理员模式下运行CMD,但没有成功。
我有一个PHP脚本充当我的后端数据库的JSON API.
意思是,你发送一个HTTP请求,如:http://example.com/json/?a = 1&b = 2&c = 3 ...它将返回一个json对象,其结果集来自我的数据库.
PHP非常适用于此,因为它实际上大约有10行代码.
但我也知道PHP很慢,而且这个API有时被称为每秒40x,而PHP正在努力跟上.
有没有办法可以将我的PHP脚本编译成更快的执行格式?我已经在使用PHP-APC,它是PHP和FastCGI的字节码优化.
或者,是否有人推荐我重写脚本的语言,以便Apache仍然可以处理example.com/json/请求?
谢谢
更新:我刚刚运行了一些基准测试:
正如您所注意到的,PHP在生成结果时要慢一个数量级.网络似乎不是这种情况下的主要瓶颈,但我同意它通常是根本原因.
我在我的服务器上安装了Django,Nginx和FastCGI.这是我的开发服务器,我在使用缓存时非常困难.每当我进行更改时,我必须重新启动整个服务器以查看实际更改.重新启动Nginx进程没有帮助eithter.
所以它可能是Django和/或FastCGI进行缓存.我还查看了settings.py,并且Django上没有缓存设置.
什么是确保何时更改页面代码时自动重置缓存的最佳方法?非常感谢您的帮助.
我使用django上nginx有FastCGI和我有一个问题urls.py.根据这个问题,django缓存了url.py文件,我就像上面问题的作者一样 - 无法修改我的URL定义.
我的问题是 - 有没有办法在没有服务器重启的情况下清除django/nginx/fcgi中的url缓存(这无论如何都没有帮助)?
app = redmine-2.0.1
ruby = ruby 1.9.3p194(2012-04-20 revision 35410)[x86_64-linux]
[root@by1016690 public]# ./dispatch.fcgi
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- fcgi (LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/fastcgi.rb:1:in `<top (required)>'
from ./dispatch.fcgi:19:in `<main>'
Run Code Online (Sandbox Code Playgroud) 我有关于fsockopen的php问题
服务器:
VPS CentOS 6.3(最终)PLESK 11
问题:
如果我使用FastCGI函数fsockopen不起作用.我得到:警告:fsockopen():无法连接到xx.xx.xx.xx:80(权限被拒绝)
如果我在plesk 11中编辑网站(用于测试)并将其设置为apache,则可以正常工作.
我找不到解决这个问题的方法.有人有线索吗?
我已经在Perl上编程了很长时间,我一直使用CGI技术来构建我的应用程序.现在我想重建它们并在FCGI上写新的.请解释使用fe Starman取消使用FastCGI和PSGI之间的区别.另外我要解释一下Perl框架(使用FCGI)今天是什么"趋势"?我知道我可以使用CGI :: Fast强制我的CGI脚本作为FCGI脚本工作.有没有其他模块可以做到这一点?
谢谢!
fastcgi ×10
nginx ×3
php ×3
django ×2
apache ×1
centos ×1
cgi ×1
compilation ×1
fsockopen ×1
iis ×1
iis-8 ×1
mamp ×1
mamp-pro ×1
mod-fastcgi ×1
optimization ×1
performance ×1
perl ×1
psgi ×1
python ×1
ruby ×1
web-config ×1
wfastcgi ×1