FastCGI和DB连接/全局变量? [英] FastCGI and DB connections / global variables?

查看:81
本文介绍了FastCGI和DB连接/全局变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用FastCGI时,我需要使用常规CGI以不同的方式编码

吗?因为PHP.exe进程不会消失所以

全局变量从页面请求到页面请求一直存在,

创建需要更好的管理/池化DB连接?


Josh

When I''m using FastCGI do I need to code differently than I do when
using regular CGI? Because the PHP.exe processes don''t go away do
global variables stick around from page request to page request,
creating the need for better managment / pooling of DB connections?

Josh

推荐答案



Joshua Ruppert写道:

Joshua Ruppert wrote:

当我使用FastCGI时,我需要使用常规CGI以不同的方式编码

吗?因为PHP.exe进程不会消失所以

全局变量从页面请求到页面请求一直存在,

创建需要更好的管理/池化DB连接?


Josh
When I''m using FastCGI do I need to code differently than I do when
using regular CGI? Because the PHP.exe processes don''t go away do
global variables stick around from page request to page request,
creating the need for better managment / pooling of DB connections?

Josh



从编程的角度来看,没有区别。全局变量

在每个请求结束时被销毁。

There is no difference from a programming standpoint. Global variables
are destroyed at the end of each request.


用那说我不知道​​我的问题是什么是。我有一个网站,已经开发了运行Win2K和PHP 4的
,我试图将
切换到FastCGI。当我这样做的时候,每一件事都运行得很好,而且,直到我们的流量达到峰值。 (自从尝试了FastCGI以来,我们已经将
移到了Win2K3。)


问题的根本原因似乎是数据库的响应时间

服务器,但我不确定。当数据库服务器加载时,PHP进程似乎挂起,等待数据库

响应。最终这影响了每个由
FastCGI启动的PHP进程,完全取消了网站。


我发现重启PHP进程的唯一方法是重新启动

机器,因为任务管理器确实让我杀死了由FastCGI启动的
流程。


有没有什么你可以看到(慢速DB连接或其他)

会导致这种行为吗?


我使用了PHPLens.com EasyWindows PHP安装程序,但是我正在寻找帮助我微调FastCGI操作的资源。


我们非常感谢任何建议。

Chung Leong写道:
With that said I''m not sure what my problem is. I have a website that
has already been developed running Win2K and PHP 4, that I tried to
switch over to FastCGI. When I did this every thing ran fine for a
while, until we had a spike in traffic. (Since FastCGI was tried we
have moved to Win2K3.)

The root cause of the problems seems to be the response time of the DB
servers but I''m not certain. When the database servers became loaded,
the PHP processes seemed to hang while waiting for the database to
respond. Eventually this effected each of the PHP processes started by
FastCGI, completely taking down the site.

The only way I found to restart the PHP processes is to reboot the
machine, because task manager did let me kill the processes that were
started by FastCGI.

Is there anything that you could see (slow DB connections or otherwise)
that would cause this kind of behavior?

I used the PHPLens.com EasyWindows PHP Installer, but I''m having
trouble finding resources to help me fine tune FastCGI opperation.

Any suggestions are greatly appreciated.
Chung Leong wrote:

Joshua Ruppert写道:
Joshua Ruppert wrote:

当我使用FastCGI时,我是否需要代码与使用常规CGI的
时的代码不同?因为PHP.exe进程不会消失所以

全局变量从页面请求到页面请求一直存在,

创建需要更好的管理/池化DB连接?


Josh
When I''m using FastCGI do I need to code differently than I do when
using regular CGI? Because the PHP.exe processes don''t go away do
global variables stick around from page request to page request,
creating the need for better managment / pooling of DB connections?

Josh



从编程的角度来看没有区别。全局变量

在每个请求结束时销毁。


There is no difference from a programming standpoint. Global variables
are destroyed at the end of each request.


Joshua Ruppert写道:
Joshua Ruppert wrote:

问题的根本原因似乎是响应DB

服务器的时间,但我不确定。当数据库服务器加载时,PHP进程似乎挂起,等待数据库

响应。最终,这影响了由

FastCGI启动的每个PHP进程,完全取消了网站。
The root cause of the problems seems to be the response time of the DB
servers but I''m not certain. When the database servers became loaded,
the PHP processes seemed to hang while waiting for the database to
respond. Eventually this effected each of the PHP processes started by
FastCGI, completely taking down the site.



嗯。什么是数据库服务器?也许一个脚本已经意外地打开了一个交易


Hmmm. What''s the database server? Maybe a script has left a transaction
open by accident?


我发现重启PHP进程的唯一方法就是重启

机器,因为任务管理器确实让我杀死了FastCGI启动的
流程。
The only way I found to restart the PHP processes is to reboot the
machine, because task manager did let me kill the processes that were
started by FastCGI.



按主题排序,但我想你会发现Windows中的kill util

Resource Kit非常方便。

Sort off topic, but I think you''ll find the kill util in the Windows
Resource Kit quite handy for situations like that.


这篇关于FastCGI和DB连接/全局变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆