12

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

1
  • This sounds like a case of multiple php.ini's, and the CLI interface using a different one. Can you do a phpinfo() to see which file gets used? Commented Feb 28, 2010 at 12:05

1 Answer 1

22

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Also note per above and per the install docs that you should use 'zend_extension' not 'zend_extension_ts' for the latest versions of PHP. I've seen zend_extension_ts recommended in quite a few places. Reference: xdebug.org/docs/install
A footnote for Windows users: the path to xdebug needs to be a full path in quotes (eg. zend_extension="C:\Program Files\ ... ")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.