奇怪的5秒暂停与PHP命令行界面(与mysql / mysqli扩展相关) [英] Strange 5 second pause with PHP command line interface (related to mysql/mysqli extension)

查看:206
本文介绍了奇怪的5秒暂停与PHP命令行界面(与mysql / mysqli扩展相关)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从命令行PHP客户端(Windows上的PHP 5.2)执行PHP脚本时,我遇到了一个奇怪的5到7秒的暂停。

I'm getting a strange 5 to 7 second pause when executing PHP scripts from the command-line PHP client (PHP 5.2 on Windows).

PHP脚本似乎冻结一段时间,然后返回到命令提示符。它不使用任何显着的CPU时间,它就像它等待一些延迟。

During this pause the PHP script just appears to 'freeze' for a while before returning to the command prompt. It is not using any significant CPU time, it's like it is waiting for some delay.

在尝试PHP.ini后,我已经缩小到这一事实mysql或mysqli扩展被启用。如果这些扩展都被禁用,没有烦人的暂停,PHP脚本只会在几毫秒内终止。

After experimenting with PHP.ini, I've narrowed this down to the fact that the mysql or mysqli extension is enabled. If these extensions are both disabled, no annoying pause and the PHP script terminates in mere milliseconds.

我使用的命令是:

"C:\Program Files\PHP\php.exe" -f %1

其中%1是PHP脚本。

Where %1 is the PHP script.

即使正在执行的PHP脚本基本上为空:

The pause still occurs even if the PHP script being executed is essentially empty:

<?php

?>

你知道是什么原因导致这个暂停,我怎么能删除它,同时仍然允许mysql或mysqli支持对于命令行上的PHP?

Do you know what is causing this pause and how I can remove it while still allowing mysql or mysqli support for PHP on the command line?

推荐答案

这是一个 mysql中的错误。你可以通过获取最新的libmysql.dll(5.1.31或更高版本,一些旧版本也工作 - 请参阅第二个链接)来解决它。确保这是libmysql.dll实际使用,并且在您的路径中没有其他libmysql.dll。有关详情,请参阅相关 php问题

it's a bug in mysql. you can solve it by getting the latest libmysql.dll (5.1.31 or higher. some older versions also work - see second link). make sure that's the libmysql.dll actually used and there are no other libmysql.dlls in your path. see the related php issue for details.

这篇关于奇怪的5秒暂停与PHP命令行界面(与mysql / mysqli扩展相关)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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