Strange 5 second pause with PHP command line interface (related to mysql/mysqli extension)

前端 未结 4 1883
独厮守ぢ
独厮守ぢ 2021-01-05 11:50

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).

During this pause the PHP script just ap

相关标签:
4条回答
  • 2021-01-05 11:53

    I also experienced an annoying 2 second delay running PHP from the command line under Windows 7 64bit.

    This version had a delay:
    php.exe (v5.3.5) shipped with ZendServer Community Edition

    This version was wonderfully quick:
    php.exe (v5.3.6) shipped with EasyPHP

    (Sorry to bump an ancient thread, but hopefully this helps others Googling this issue.)

    0 讨论(0)
  • 2021-01-05 12:01

    For me (Zend Server CE on Mac OS X), the imap exetension was the culprit. Disabling it solved the problem.

    Anoyone wants to write a PHP extension bisecting script? :)

    0 讨论(0)
  • 2021-01-05 12:04

    On linux in 2020 with PHP 7.4 this still happens. The solution was to link my hostname to 127.0.0.1 in the /etc/hosts file, so the 5 second delay was from looking up my own hostname (and not finding it). While on servers I have set up the hostnames, I didn't really do that on my desktop systems (and it does not do that automatically).

    To solve it, run hostname on the command line (to see the hostname of the current machine) and then add this line to /etc/hosts:

    127.0.0.1 yourhostname
    

    Where you would replace yourhostname with what hostname showed you.

    0 讨论(0)
  • 2021-01-05 12:12

    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.

    0 讨论(0)
提交回复
热议问题