What's the difference between "extension" and "zend_extension" in php.ini?
Asked Answered
H

2

46

When I installed Xdebug through pecl, it added the following line to my php.ini file.

extension="xdebug.so"

and everything I used worked. Until today.

Today I was having trouble setting up Xdebug for interactive debugging. I couldn't get anything working until I changed the above to

zend_extension="/usr/local/lib/php/extensions/xdebug.so"

(Caveat: I think this is what got me working, but I'm not 100% sure)

This raised the question in my mind. What's the difference in loading an extension via extension= vs. zend_extension?

Heal answered 18/11, 2009 at 18:18 Comment(1)
Indeed I failed to read the instructions also. Oddly enough extension=xdebug.so allowed me to remote debug using xdebug_break() but not IDE breakpoints.Bil
E
24

At the core of the PHP language (more like the interpreter, because a language is just a specification) is a software (interpreter, bytecode compiler) called "Zend Engine" developed by Zend.

Every module which messes with this core should be installed as a "zend_extension".

And yet, to solve your problem, ignore this attempt at explanation and consult the docs of the extension you're configuring - http://www.xdebug.org/docs/install.

Eastnortheast answered 18/11, 2009 at 18:38 Comment(0)
W
40

Zend_extentions are extensions that are built into the Zend engine itself. The engine parses, interprets and executes PHP script. Changing the engine changes the way that PHP works.

The included diagram will describe the main difference between an extension and a zend_extension.

Both types of extensions share lots of functionality. The difference between both types is mainly with the hooks that they register into the Engine. Despite it being very uncommon, an extension can be both a PHP extension and a Zend extension. Xdebug is a good example.

Find below image for main schema Comparison of extensions and zend_extensions

For more details refer to this link

Weeny answered 9/10, 2013 at 8:51 Comment(1)
I appreciate that detail link that explained to me that Zend Extensions cannot be compiled into php statically which answered an old question I had.Tawana
E
24

At the core of the PHP language (more like the interpreter, because a language is just a specification) is a software (interpreter, bytecode compiler) called "Zend Engine" developed by Zend.

Every module which messes with this core should be installed as a "zend_extension".

And yet, to solve your problem, ignore this attempt at explanation and consult the docs of the extension you're configuring - http://www.xdebug.org/docs/install.

Eastnortheast answered 18/11, 2009 at 18:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.