开发者

PHP throwing XDebug errors ONLY in command line mode

I've been having a few problems running PHP-based utilities within the command line ever since I enabled the XDebug. It runs just fine when 开发者_Python百科executing script through a browser, but once I try an execute a script on the command line, it throws the following errors:

h:\www\test>@php test.php
PHP Warning:  PHP Startup: Unable to load dynamic library 'E:\development\xampplite\php\ext\php_curl.dll' - The specified module could not be found in Unknown on line 0
PHP Warning:  Xdebug MUST be loaded as a Zend extension in Unknown on line 0

h:\www\test>

The script runs just fine after this, but it's something I can't seem to wrap my head around. Could it be a path issue within my php.ini config? I'm not sure if that's the case considering it throws the same error no matter where I access the @php environmental variable.

Also, all paths within my php.ini are absolute. Not really sure what's going on here.


Chances are you are using two different .ini files :

  • One for used by Apache
  • And another for CLI

Or maybe you have the same problem with PHP used by Apache, but don't see that warning, as it's in Apache's error log -- and it's only a warning.


The solution, basically, is to load the Xdebug extension using :

zend_extension=/.../xdebug.so

instead of :

extension=/.../xdebug.so

This is exactly what the error message indicates : Xdebug MUST be loaded as a Zend extension -- except it doesn't tell you how to do that.


Note :

  • I'm using an absolute path to xdebug.so -- you're already doing that, which is nice (it's required anyway)
  • But I am also using zend_extension : Xdebug is an extension that hooks deep into PHP's Zend engine, which means using extension is not enough.

For more informations, and as a reference, see the Installation / activation page in Xdebug's documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜