Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the Difference Between Extension and zend_extension in php.ini?

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?

like image 576
Alan Storm Avatar asked Nov 18 '09 18:11

Alan Storm


People also ask

What is a Zend extension?

A Zend extension hooks into "lower levels" of the language. A single extension can be both a PHP extension AND a Zend extension as well. Xdebug is both, for example, using the Zend extension component to hook into lower layers of the language to intercept calls for debugging.

Where do I put Zend extension in PHP INI?

To add the extension, go to the extension directory, <install_path>\ZendServer\lib\phpext, and add the . dll file there. Go to your php. ini file and add the following line: extension=<extension_name>.


1 Answers

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

like image 112
Praveen D Avatar answered Oct 20 '22 19:10

Praveen D