slow php command line performance - is this normal

2020-04-08 13:38发布

I have a simple PHP app that prints 'hello world'. When I run it from the command line it takes 6 seconds. Is this normal? It seems to take 1 seconds before "hello world" prints, then 5 seconds after.

I am running PHP version 5.2.12 on Windows Server 2008 R2. Could this be an install issue, or is it typical? I did a manual install of PHP then added whatever components were needed to run Drupal. The only PHP addon I remember adding was MDB2, CGI support is there too.

I am used to a Lua project I run from the command line, hundreds of lines of code that will run in under a second.

I have some unit tests I run from the command line, and already with just a few they are very slow. I run them from Netbeans and the tests are still very slow.

I run precisely this:

C:\temp>copy con test.php
<?php
print('hello, world');
^Z
        1 file(s) copied.

C:\temp>test.php
hello, world

标签: php
1条回答
够拽才男人
2楼-- · 2020-04-08 14:13

The only way I could figure to solve this was to go through my php.ini file and look for anything weird. Eventually I tried disabling loaded DLLs, and that address the problem. The DLL's impacting performance were php_curl.dll and php_mysql.dll, though I only needed to remove php_curl.dll to address the problem.

php_mysql.dll doesn't cause any problems on its own. php_curl.dll adds a 1 second delay, and a 4 second delay if used with php_mysql.dll. I don't remember why I added php_curl.dll so I guess I'll take it out for now.

查看更多
登录 后发表回答