下面是使用CGI抓取提交的表单数据的典型Perl代码片段(sample.pl),将表单数据传递给DBI,DBI然后从MySQL检索所需的行,然后将结果交给Template Toolkit呈现为HTML文档以供显示.
sample.pl的代码清单:
#!/usr/bin/perl
use strict;
use CGI;
use DBI:
use Template;
#Grab submitted form data
my $cgi = CGI->new();
my $idFromSomewhere= $cgi->param('id');
my $driver = "mysql";
my $server = "localhost:3306";
my $database = "test";
my $url = "DBI:$driver:$database:$server";
my $user = "apache";
my $password = "";
#Connect to database
my $db_handle = DBI->connect( $url, $user, $password )
or die $DBI::errstr;
#SQL query to execute
my $sql = "SELECT * FROM tests WHERE id=?";
#Prepare SQL …Run Code Online (Sandbox Code Playgroud) 我遇到503 - 服务不可用错误.我检查了事件日志,发现了这个:
模块名称FastCgiModule路径C:\ WINDOWS\System32\inetsrv\iisfcgi.dll从注册返回错误.数据是错误的.
注意:每次我尝试访问我的网站时,我都会发现DefaultAppPool会自动停止.并在事件日志中也发现了这一点:
由于为该应用程序池提供服务的进程出现一系列故障,应用程序池"DefaultAppPool"正在自动禁用.
好的,我有一个坦白 - 我仍然运行大量的 FCGI 设置(只是配置了很多服务器)。我正在尝试使其适应 rvm。在 fcgi 设置中,我可以指定要执行的命令行命令来运行我的应用程序(Sinatra、Rack、Bundler 等等),这就是我在没有 rvm 的情况下所做的
"bin-path" => "bundle exec rackup",
"bin-environment" => (
"RACK_ENV" => "development"
),
Run Code Online (Sandbox Code Playgroud)
假设我的机架文件只是 config.ru。现在,在我的 Mac 上,这有效:
"bin-path" => env.HOME + "/.rvm/gems/ruby-1.9.2-p180/bin/bundle exec rackup " + CWD + "/config.ru",
"bin-environment" => (
"BUNDLE_GEMFILE" => CWD + "/Gemfile",
"RACK_ENV" => "development"
),
Run Code Online (Sandbox Code Playgroud)
但不在服务器上。当调度程序启动时,它们会得到一个精简的环境,其中 RVM 外壳技巧不再起作用。我想我应该使用包装器选项来制作某种包装器,但我真的不明白这将如何缓解我的问题以及使用哪些参数。有没有人在没有加载 RVM shell env 的情况下执行特定的 ruby 和 gem 二进制文件的经验?
PS 为了防止偏离主题的答案,不,谢谢,我不需要 Ruby 1.8.7、Passenger 或 nginx。
在fastcgi_finish_request();声明后在我的 php 脚本中实施一些后处理后,我担心一些差异。
看起来 PHP 在 fastcgi_finish_request 之后没有执行所有脚本。
在日志文件中,我找不到关于这部分的通知,没有警告,没有错误或违规行为。
文档中是否有使用 fastcgi_finish_request 的限制或提示?
可能重复:
如何使用Nginx阻止网关超时
我正在使用现有的SOAP API通过XML导入数据.有时,当XML太大时,我会在60秒后获得504网关超时.
我试图在nginx.conf中将fastcgi_read_timeout设置为300,但它不起作用.我已将maximum_execution_time更改为3600
有人知道如何更改超时?
我刚刚用Nginx安装了php FASTCGI(php-fpm)v.5.5.在一个新的Centos6.4上
我正在尝试安装memcached但遇到很多问题.....这是我的步骤:
/bin/rpm -ivh http://ftp.uninett.no/linux/epel/6/i386/epel-release-6-8.noarch.rpm
/bin/rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi,remi-php55 install nginx php-common php-fpm php-mysqlnd
Run Code Online (Sandbox Code Playgroud)
但在尝试添加memcached时:
yum install php-pecl-memcached.x86_64 (Extension to work with the Memcached caching daemon)
Run Code Online (Sandbox Code Playgroud)
它失败了......:
> Resolving Dependencies
> --> Running transaction check
> ---> Package php-pecl-memcached.x86_64 0:1.0.0-1.el6 will be installed
> --> Processing Dependency: php(zend-abi) = 20090626 for package: php-pecl-memcached-1.0.0-1.el6.x86_64
> --> Processing Dependency: php(api) = 20090626 for package: php-pecl-memcached-1.0.0-1.el6.x86_64
> --> Processing Dependency: libmemcached.so.2(libmemcached_2)(64bit) for package: php-pecl-memcached-1.0.0-1.el6.x86_64
> --> Processing Dependency: libmemcached.so.2()(64bit) for package: …Run Code Online (Sandbox Code Playgroud) 通过fastcgi进入Nginx的HHVM不支持fastcgi_param是否正确?如果是这样,如何解决?
喜欢:
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; }
expires off;
fastcgi_pass 127.0.0.1:9999; <- my hhvm is set to port 9999 io 9000
fastcgi_param PHP_VALUE "error_log=/var/report/PHP.error.log";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE admin;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;
}
Run Code Online (Sandbox Code Playgroud) 在使用nginx和php5-fpm的Debian Jessie机器上运行shopware 5 ,我们经常得到502 Bad Gateway.这种情况主要发生在后端,当较长的操作像缩略图创建一样工作时,即使这是在单个ajax请求的小块内完成的.
使用64 GB RAM和16个核心的旧服务器正在睡觉,因为它上面没有真正的流量.我们目前使用它就像一个临时系统,除非我们修复了像这样的所有错误.
在nginx-error日志中,可以找到以下行:
[error] 20524#0: *175 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: domain.com, request: "POST /backend/MediaManager/createThumbnails HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com", referrer: "http://www.domain.com/backend/"
[error] 20524#0: *175 no live upstreams while connecting to upstream, client: xx.xx.xx.xx, server: domain.com, request: "POST /backend/Log/createLog HTTP/1.1", upstream: "fastcgi://php-fpm", host: "www.domain.com", referrer: "http://www.domain.com/backend/"
[error] 20524#0: *175 connect() failed (111: Connection refused) while connecting to upstream, client: …Run Code Online (Sandbox Code Playgroud) 我已经在Windows / IIS 10.0上使用wfastcgi在Windows域帐户下运行Python 3.6的情况下成功设置了示例Flask应用程序。
现在,我试图将IIS Windows身份验证用户信息传递给我的Flask应用程序。我仅在IIS中启用了Windows身份验证,并且我的浏览器成功进行了身份验证。
我如何找出哪个用户正在WSGI中访问该网站?我检查了环境变量和HTTP标头,但没有碰到运气。
PHP似乎有一个fastcgi.impersonate -Option,但是似乎没有Python的挂件。