我一直在使用以下网站编程:
突然对mysql做了一些"SHOW CREATE TABLE"查询,我得到了这个.
[Wed Jul 20 17:35:23 2011
] [notice] EACCELERATOR(5827): PHP crashed on opline 138 of fetch_fields() at /usr/lib/php/Zend/Db/Statement/Mysqli.php:235
Run Code Online (Sandbox Code Playgroud)
我试过禁用eaccelerator但没有成功
[Wed Jul 20 17:45:34 2011] [warn] [client 190.78.208.30] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Jul 20 17:45:34 2011] [error] [client 190.78.208.30] Premature end of script headers: index.php
[Wed Jul 20 17:45:34 2011] …Run Code Online (Sandbox Code Playgroud) 我不是 Perl 世界的人,所以其中一些对我来说是新的。我正在运行 Ubuntu Hardy LTS,并安装了 apache2 和 mod_fcgid 软件包。我想让 MT4 在 fcgid 而不是 mod-cgi 下运行(它似乎可以在普通的 CGI 下运行)。
我似乎无法让一个简单的 Perl 脚本在 fcgid 下运行。我创建了一个简单的“Hello World”应用程序,并包含了上一个问题中的代码来测试 FCGI 是否正在运行。
我将脚本命名为 HelloWorld.fcgi(当前 fcgid 设置为仅处理 .fcgi 文件)。代码:
#!/usr/bin/perl
use FCGI;
print "Content-type: text/html\n\n";
print "Hello world.\n\n";
my $request = FCGI::Request();
if ( $request->IsFastCGI ) {
print "we're running under FastCGI!\n";
} else {
print "plain old boring CGI\n";
}
Run Code Online (Sandbox Code Playgroud)
当从命令行运行时,它会打印“plain old Boring...”当通过对 apache 的 http 请求调用时,我收到 500 内部服务器错误,并且脚本的输出被打印到 Apache 错误日志中:
Content-type: text/html
Hello …Run Code Online (Sandbox Code Playgroud) 我试图在Apache上使用FastCGI(实际上是fcgid)配置Python迷你框架CherryPy.我在共享主机上,所以我无法访问httpd.conf,只有htaccess.我遵循这些教程无济于事:
我不断收到500条错误,而Apache日志上写着"脚本标题过早结束".我已经尝试了一切(权限/ shebangs/full-paths/deamonized/not-daimonized).我知道Apache正在执行我的.fcgi,因为我能够从python打印到错误日志,但就是这样.之前有没有人在共享主机上成功安装过CherryPy或任何其他框架?非常感谢您的帮助.谢谢.
我使用tinyMCE和PHP压缩器.我想将它放在一个文件夹中,由我的服务器上需要它的所有域使用,而不是每个站点的副本.但是,因为我知道它不是跨域的,所以我认为我可以将它放在每个站点可以通过符号链接到达的文件夹中.
但是我收到了这个PHP错误:
No input file specified.
Run Code Online (Sandbox Code Playgroud)
我的印象是它与tinyMCE本身的关系不如使用符号链接,但我没有任何线索.
有人知道吗?
谢谢!
更新:
经过大量挖掘后,它似乎与Apache有关.PHP通过FCGId运行,似乎是一个权限错误.但是如果我用mod_php运行它,我会得到一个错误500.
解决方案:
将其作为一个真正的答案,以便问题没有答案......见下文
这个.htaccess文件:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 4 month"
</IfModule>
<IfModule mod_headers.c>
Header merge X-ModHeaders "Yes, it is installed"
</IfModule>
Run Code Online (Sandbox Code Playgroud)
...在我的开发框(Windows框,Apache/2.4.10,PHP作为Apache模块运行)中按预期工作,其中“有效”意味着它为所有资源(静态或动态)生成适当的标头。
但是,在我的生产服务器(Linux 机器,Apache/2.2.31,PHP 作为 FastCGI 与 mod_fcgid/2.3.9 运行)中,它仅适用于静态资产,不适用于 PHP 脚本。
我怀疑差异来自 PHP SAPI 是否正确?有没有办法修复它,这样我就不需要复制生成 HTTP 标头的代码?
我的应用程序尝试访问超时的URL存在问题.我正在尝试捕获此超时并使用此代码解决此问题:
$timeout = 120;
if(false == $handle = @fsockopen($host, $port, $errno, $errstr, $timeout))
{
throw new Exception("Could not connect to url: ".$errstr);
}
$getRequest = "GET {$url} HTTP/1.0\r\n";
$getRequest .= "Host: {$urlParts['host']}\r\n";
$getRequest .= "Connection: close\r\n\r\n";
fwrite($handle, $getRequest);
$maxExecutionTime = ini_get('max_execution_time');
set_time_limit($timeout+10);
stream_set_timeout($handle, $timeout);
$head = fread($handle, 1024); // Read the first 1024 bytes
if($maxExecutionTime == 0) {
$maxExecutionTime = 30;
}
set_time_limit($maxExecutionTime);
$stream_metadata = stream_get_meta_data($handle);
if($stream_metadata['timed_out'] === true) {
throw new Exception("Connection timed out");
}
Run Code Online (Sandbox Code Playgroud)
我用于超时的我的URL是在防火墙后面,所以我不能共享它,但它被设计为sleep()5分钟.当我尝试运行此代码时,执行将停止在$ head = fread($ …
我找到了http://support.zeus.com/zws/examples/2005/12/16/hello_world_in_perl_and_c,这两个例子正在运行.
现在我为Ada尝试了这个,我从2天后就无法完成它.
fcgi_stdio.ads
with Interfaces.C;
with Interfaces.C.Strings;
package fcgi_stdio is
function FCGI_Accept return Interfaces.C.int;
pragma Import (C, FCGI_Accept, "FCGI_Accept");
procedure FCGI_printf (str : Interfaces.C.Strings.chars_ptr);
pragma Import (C, FCGI_printf, "FCGI_printf");
end fcgi_stdio;
Run Code Online (Sandbox Code Playgroud)
test.adb
with fcgi_stdio;
with Interfaces.C;
with Interfaces.C.Strings;
procedure Test is
begin
while Integer (fcgi_stdio.FCGI_Accept) >= 0 loop
fcgi_stdio.FCGI_printf (Interfaces.C.Strings.New_String ("Content-Type: text/plain" & ASCII.LF & ASCII.LF));
fcgi_stdio.FCGI_printf (Interfaces.C.Strings.New_String ("Hello World from Ada!" & ASCII.LF));
end loop;
end Test;
Run Code Online (Sandbox Code Playgroud)
当我在控制台中运行它时,我收到以下错误:
$ ./test
raised STORAGE_ERROR : stack overflow or erroneous …Run Code Online (Sandbox Code Playgroud) 你好,我尝试安装 libapache2-mod-fcgid mod 但总是出现错误。
root@mail:~# sudo apt-get install libapache2-mod-fcgid
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-fcgid : Depends: apache2.2-common but it …Run Code Online (Sandbox Code Playgroud) 当我尝试将Flask应用程序部署到我的LAMP服务器时,我从flipflop收到错误,这是一个FastCGI/WSGI网关,它使我的应用程序能够说出FastCGI协议.
〜/最小/ run.py
from flask import Flask
from flipflop import WSGIServer
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'hello, world'
if __name__ == '__main__':
WSGIServer(app).run()
Run Code Online (Sandbox Code Playgroud)
Apache配置文件的相关部分,即/etc/httpd/conf/httpd.conf:
<VirtualHost *:80>
ScriptAlias / /home/apps/minimal/run.py
ErrorLog /var/log/httpd/error_log
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
Apache/2.2.15的错误报告:
[apps@kernod0 ~]$ sudo head -n 20 /var/log/httpd/error_log
[sudo] password for apps:
[Wed Aug 16 16:39:16 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 16 16:39:16 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 16 16:39:16 2017] [notice] …Run Code Online (Sandbox Code Playgroud) 在我的Plesk 11中,PHP 5.4.7.Apache/2.4.3系统,当我创建cron作业时,我从error.log文件中得到此错误.
[Tue Mar 19 21:33:18 2013] [warn] [client 88.44.55.66] mod_fcgid: read data timeout in 45 seconds
[Tue Mar 19 21:33:18 2013] [error] [client 88.44.55.66] Premature end of script headers: index.php
Run Code Online (Sandbox Code Playgroud)
所以我检查了执行时间:
echo ini_get('max_execution_time');
Run Code Online (Sandbox Code Playgroud)
我有这个价值: 1560000
它似乎不是超时问题,但我得到超时错误?
回答以后的参考:使用vim
编辑/etc/httpd/conf.d/fcgid.conf文件.
更改FcgidIOTimeout 45到FcgidIOTimeout 600.
重启Apache.然后将解决快速CGI超时.
我的一位网站客户在下订单时遇到了问题。当我检查错误日志时,我可以看到以下内容:
[warn] mod_fcgid: read data timeout in 45 seconds, referer: https://myDomain/cart
[error] Premature end of script headers: index.php, referer: https://myDomain/cart
Run Code Online (Sandbox Code Playgroud)
这个错误是什么意思?我应该怎么做才能消除这个错误?Plesk 控制面板中是否有任何设置需要更改?如果我将“Php设置”中的“max_execution_time”更改为3600可以解决吗?
我使用的是 Plesk 12.0.18、CentOS 5.11
如果问题定义有点脱节,我深表歉意。我们已经在许多不同的媒介上攻击了这个问题。
基本描述,我们有一个网站,我们正在尝试提供使用Locale :: TextDomain的翻译
我们有fastcgi脚本,该脚本调用了我们的perl模块本地库。Fastcgi和翻译是棘手的(因为我们正在使用它),因为语言是在脚本启动时设置的,并且会持续存在。
因此,在我们的perl模块库中,此方法有效。
package SR::Locale;
our $LOCALE_NAMESPACE = 'es';
use Locale::TextDomain::UTF8 qw( $LOCALE_NAMESPACE );
our $word = __("football");
Run Code Online (Sandbox Code Playgroud)
但是我们找不到在启动时动态设置变量$ LOCALE_NAMESPACE的方法。我们想基于request_uri或正在执行的脚本的dir路径或类似的东西进行设置。所以我们想做类似的事情,但是我们不能在快速的cgi设置中解决这个问题:
package SR::Locale;
$ENV{REQUEST_URI} =~ m{example.com/(..)/}
our $LOCALE_NAMESPACE = $1;
use Locale::TextDomain::UTF8 qw( $LOCALE_NAMESPACE );
our $word = __("football");
Run Code Online (Sandbox Code Playgroud)
在此示例中(对于fastcgi),$ ENV {REQUEST_URI}在脚本启动时模块中为空白。
任何帮助将非常感激。我无法在perl中找到任何有关翻译和fastcgi的参考。