Wednesday, June 4, 2008

Xdebug MUST be loaded as a Zend extension

XDebug profiler not working ?
Found this in your error log ?

PHP Warning: Xdebug MUST be loaded as a Zend extension ...

You've probably installed or php_xdebug.dll using a line similar to this in php.ini.

; or

Well the fix seems to be simple, as seen in xdebugs installation instructions.

You need to use a different directive, and you need to specify the entire path to the so/dll.

Making Windows something similar to this
zend_extension_ts = "c:/php/modules/php_xdebug.dll"

And making UNIX/PECL something like this
zend_extension = "/usr/lib/php5/modules/"

I imagine the "_ts" corosponds to "Thread Safe" which could mean the "_ts" directive needs to be used on IIS, Apache2, & other multi-threaded servers, but I'm not entirely sure & haven't found any documentation on that yet.
So far the non-_ts version is working on my Apache2 test box, though.

Update: Using "zend_extension_ts" didn't work at all on my Debian/Apache2 box.

Now if you're using the new directive and still getting errors, which happen to come half-a-dozen at a time, in your logs, then you will want to add the directory used for extension_dir to the value of include_path in php.ini.

; Assuming the following
;extension_dir = "/path/to/extensions"
;extension_dir = "c:\path\to\extensions"

; UNIX: "/path1:/path2"
;include_path = ".:/usr/share/php:/path/to/extensions"
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes;c:\path\to\extensions"


Anonymous said...

well, using full path didn't me at all.

i have used 'zend_extention' instead of 'zend_extension_ts'

and disabled loading xdebug...dll as extention. now works fine.

i mean, configuration depends on each build.

Anonymous said...

You saved me a lot of hours. Thanks my friend. I found yous solution after 8 hours. The problem was that it didn't stop to breakpoints. You saved me. Thanks!!!!


Anonymous said...

According to the XDebug documentation, "From PHP 5.3 onwards, you always need to use the zend_extension [and not] zend_extension_ts [or] zend_extension_debug [however the compile options still have to match]"

In other words, it looks like *_ts is deprecated / removed. Removing the "ts" and "debug" directives (and then checking via 'php -m' worked for me).

Anonymous said...

Thanks a lot for the hint.
I was about to start banging my head against the wall.

One thing I had to do though was to rename xdebug.ini to A_xdebug.ini to have the extension be loaded before all others.
(OpenSUSE 11.4, Apache, php 5.3.14, Zend Server CE 5.6.0)