为什么需要 `zend_extension = xdebug`?
My system is:
- Windows 11 Pro
- Xampp
- PHP 8.2.12
- xdebug v3.5.1
I define the binary in my php.ini as
zend_extension = "D:\websites\php\ext\php_xdebug-3.5.1-8.2-ts-vs16-x86_64.dll"
Everything is working as expected, however I ran the install wizard (https://xdebug.org/wizard) and it said everything was configured except that I should add zend_extension = xdebug to my php.ini
https://xdebug.org/docs/install
If you want to use Xdebug and OPCache together, you must have the
zend_extensionline for Xdebug below the line for OPCache, or in a file starting with a higher number (ie.99-xdebug.inivs20-opcache.ini), otherwise they won't work properly together.
If everything is working, why do I need to add this? Does it serve a purpose for me? What does it do?
解决方案
You don't need to add zend_extension = xdebug, if your current full path line is already working.
In PHP, extensions come in two types
extension = ...-> 常规PHP扩展zend_extension = ...-> Zend引擎扩展(对PHP引擎的底层钩子)
Xdebug is a Zend extension, so it must be loaded using zend_extension, not extension.
What you have is correct. According to the doc, Xdebug must be loaded after OPCache. So make sure this is in order
zend_extension=opcache
zend_extension="D:\...\php_xdebug.dll"
Why does the wizard suggest it
The Xdebug Installation Wizard gives generic advice, assuming you might install via package manager or PHP already knows where Xdebug is located
So it suggests zend_extension = xdebug
That only works if The DLL/SO is in PHP's default extension directory and PHP can resolve it automatically