Zend Debugger Extension Is Not Loading Correctly - php

I'm on windows 7 with PHP 5.4.4 TS. I'm trying to load the zend debugger extension, it's the last line on my PHP.ini file:
[Zend]
zend_extension_ts = C:\php\ext\ZendDebugger.dll
zend_debugger.allow_hosts = 127.0.0.1/32,192.168.0.1/32,10.0.0.0/8
zend_debugger.expose_remotely = always
The extension doesn't show up when I call the phpinfo() section. There is nothing in the error logs though. The extension that I am using is for PHP 5.3 though so that may be why it's not loading properly. Does anyone know if there is a TS version for PHP 5.3+ ?

I had the same problem with PHP 5.4.11. It looks like thread safe versions of ZendDebugger.dll are no longer available. Using zend_extension (instead of zend_extension_ts) with ZendDebugger.dll for 5.3.x (max version I could find) did not work for me either.
In the end I solved the problem by switching to xdebug from xdebug.org. Downloaded php_xdebug-2.2.1-5.4-vc9.dll from http://xdebug.org/download.php and adjusted php.ini as:
zend_extension="C:\php_5_4_11\ext\php_xdebug-2.2.1-5.4-vc9.dll"
zend_debugger.expose_remotely=always
xdebug.remote_enable=on
xebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Related

Loading xdebug as a Zend Extension on IIS 7

I have PHP 7.0.0 on IIS 7, Windows 10 and FastCGI all installed via the web platform installer. I am attempting to install xdebug by pasting my phpinfo() into the wizard and follow the instructions.
The problem is I am unable to configure it as a zend_extenson. When I go into PHP Manager in IIS and enable the xdebug extension, I get the following lines inserted into the php.ini file:
[PHP_XDEBUG-2.5.0RC1-7.0-VC14-NTS-X86_64]
extension=php_xdebug-2.5.0rc1-7.0-vc14-nts-x86_64.dll
If I change the line to be zend_extension instead and refresh the extensions listed in the PHP Extensions screen of IIS, it will show as disabled again. If I enable it again, it will go back to what you see above. IIS does not like zend_extension=. What am I missing?
I also see the following in the PHP log file:
PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
It turns out I had to downgrade xdebug to 2.4.1 and the connection showed up in PHP Storm. I also used the following settings in my php.ini file. The extension will not show as enabled in the IIS PHP Manager but it actually is enabled as verified on the phpinfo() page.
[PHP_XDEBUG]
zend_extension=php_xdebug.dll
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
No need to downgrade simply replace,
extension=php_xdebug.dll
with
zend_extension=php_xdebug.dll
verified to be working with Xdebug version 2.6.1 iis 7

PHP XDEBUG not getting enabled

Unable to enable XDEBUG. Any help or check if it is enabled and not reflected? I am on PHP7 and am using Xdebug 2.4.0rc2. PHP.INI settings below:
[XDebug]
zend_extension="C:/php/ext/php_xdebug.dll"
xdebug.remote_enable = on
xdebug.remote_host = localhost
xdebug.remote_port = 10000
xdebug.remote_handler = dbgp
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "profilerlogs"
xdebug.profiler_output_name = cachegrind.out.%p
Unable to get it enabled. The steps are right but doesnt show up installed in phpinfo() as well.
I had same problem with XAMPP PHP7 now it's solved :)
There should be missing or wrong extention file in your C:/php/ext/ directory.
This will solve your problem.
Go to xDebug
Dowload Xdebug 2.4.0rc1 (PHP 7.0 VC14 TS 32/64)
Rename it to php_xdebug.dll
Paste this file in "php/ext" folder
Restart your server.
Now check your phpinfo()
In my case there were 64bit version so I've just changed to 32bit
Along with what #haider-lasani said please do not forget what type of PHP you are using. The latest XAMPP is using some really convoluted setup.
Go to your PHP folder and check whether you have php7.dll or php7ts.dll. If you have the latter version then you are supposed to pick up the TS version of xdebug.
Also check VC version as well.In this case it is VC14.
Now even though I am using a TS version of PHP I still have to add the plugin with zend_extension="C:/php/ext/php_xdebug.dll" and not zend_extension_ts="C:/php/ext/php_xdebug.dll"
TL;DR
While downloading xdebug make sure you:
Check x64/x86 bit version.(Use x86 xdebug just to be safe)
Check what version of PHP you are using.
Check whether you have TS or non-TS version of PHP by checking whether you have php{x}.dll or php{x}ts.dll.{x}is your php version.
Try switching between zend_extension and zend_extension_ts to include your xdebug plugin in your php.ini file to see what works.
Following all these steps should ideally fix your problems. Let me know if you still are facing any problems. Peace.
You shouldn't need to rename your DLL and it is a good idea not to, as it allows you to see what build of XDebug you have running.
Here is what I did and it works:
This answer assumes you have PHP set up with the correct PATH entry so that you can run PHP from the Command Line such as GitBash https://git-for-windows.github.io/
Open up your command line and enter this:
$ php -i
Scroll to the top and copy the output from the command line window beginning where you see
phpinfo()
..... copy contents until you see the last line which ends:
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license#php.net.
`
Go the XDebug Windows Wizard https://xdebug.org/wizard.php and paste your PHPInfo in the big text box and submit.
A new page will display with instructions and a "System Summary of your PHP. Carefully follow the instructions and select the Download link.
Once you have modified your PHP.ini and observed where your "ext" folder is, copy your downloaded XDebug dll file to "ext" folder.
Open your command line again and enter the following command:
$ php -m
If you have correctly followed the instructions you will see the output contains the following:
[Zend Modules]
Xdebug
Otherwise, you will see an error at the top of the console output such as:
Cannot load Xdebug
Usually, the errors occur because your XDebug:
is not in the correct location
is the wrong version
is incompatible because of thread type: Your PHP maybe Thread Safe, and your XDebug is Not Thread Safe (the XDebug Wizard will automatically choose the correct version)
If you are doing remote development on either a WSL or a Linux, check your php directory as you may need to modify php.ini files in the following locations:
/etc/php/7.2/apache2/php.ini
and
/etc/php/7.2/cli/php.ini
with
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
;don't forget to change the path and filename to the correct one
;but make sure you use the full path
zend_extension="/usr/local/php/modules/xdebug.so"
I installed Xampp like a week ago. It was already installed with a php_xdebug.dll file in the ext folder.
For me the solution was to specify the xdebug file like below, without a file path:
zend_extension = "php_xdebug.dll"
If you're on Windows 10 x64 running PHP 7.2 and Apache 2.4, Specifying DLL without the full path like this
zend_extension = php_xdebug-2.8.0-7.2-vc15-x86_64.dll
worked for me because my extension_dir = "ext" was set properly in php.ini.
Here is a detail set of instructions if you're using similar setup.

XDebug / Apache / PHP / Eclipse skips breakpoints

I'm having problems with XDebug.
Configuration as follows:
Windows 7 64bit
PHP 5.4.6 Thread Safe 32 bit
Apache 2.4 Thread Safe
Eclipse PDT 3.0.2
The problem is that xdebug_break() calls are not working, and breakpoints entered through Eclipse also don't function. I can see that the extension is working, as it appears as a module in phpinfo(). When I call an uncallable method, XDebug outputs the relevant error messages.
I've modified Eclipse's web server path mapping, to no avail.
Here is my php.ini config:
zend_extension = c:/php/php_xdebug-2.2.1-5.4-vc9.dll
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 8080
xdebug.remote_mode = req
Any help would be kindly appreciated...
First check that what version you are using of PHP in eclipse....
Check it through:
Window->preference->PHP->PHP Interpreter....
Version there should match with the PHP version.....
Reply if problem is not solved....
For all those, that are still fighting with this problem, some handy tips.
Check which version (package) of Eclipse you have? It turns out, that Helios package has some bugs and doesn't stops on breakpoints, when you debug your application as Web Application. Debugging works only, if you run it as PHP Script. Which makes it pretty useless for debugging process.
You should consider either reverting to older Galileo Package Eclipse for PHP Developers or installing newest Eclipse Juno (or even newest developer version of Eclipse Kepler), which doesn't have PDT support build in, but you can easily add it to then, using Help > Install New Software.. (point it to http://download.eclipse.org/tools/pdt/updates/release).
These versions are reported to be able to debug as Web Application, respecting breakpoints.
Also, remember, that Xdebug must be run as Zend Extension in order to support breakpoints! In other words remove extension=xdebug.so (on Linux or xdebug.dll on Windows) line from your php.ini and replace it with zend_extension=/full/path/to/xdebug.so (on Linux or zend_extension=X:\full\path\to\xdebug.dll on Windows). Zend extensions requires full path, even if they're put into /php/ext folder, as regular PHP extensions. You'll find more info on this in Xdebug FAQ (look for an answer to "Xdebug is only loaded as PHP extension and not as a Zend Extension" question).

What does "XDEBUG NOT LOADED AS ZEND EXTENSION" warning means?

Xdebug is loaded, but not loaded as a zend extension. What does it mean? How to resolve this problem?
This error means that you used "extension=" to load Xdebug. That could be in your normal php.ini, or in a file called xdebug.ini that some distributions like to add. In any case, Xdebug needs to be loaded as a Zend extension for certain features such as single step debugging. As Xdebug is not meant to work as a normal extension, it might crash and burn too.
The syntax for loading Xdebug as Zend extension depends on PHP version and build. I would suggest you use http://xdebug.org/wizard.php to provide you with the correct lines.
Make sure if it is configured to load correctly as a zend_extension. Inside php.ini add this line
zend_extension="/usr/local/php/modules/xdebug.so"
Others have already explained that the error is because Xdebug is being loaded as a regular PHP module instead of as a Zend extension. You can use the wizard that Derick linked to or manually enter the line as Starx showed.
However, there is an issue that you may run into. The extensions_dir directive in php.ini currently only applies to PHP modules, not to Zend extensions. Therefore, you cannot use a common configuration like this:
[PHP]
extension_dir = .\ext
extension = php_memcache.dll
…
[zend]
zend_extension = php_xdebug-2.2.3-5.3-vc9-nts.dll
While PHP will correctly load php_memcache.dll from the ext sub-directory, it will not load php_xdebug-2.2.3-5.3-vc9-nts.dll and will throw the error Failed loading php_xdebug-2.2.3-5.3-vc9-nts.dll.
To fix this, you will need to either use an fully-qualified/absolute path such as:
zend_extension = C:\foobar\PHP\ext\php_xdebug-2.2.3-5.3-vc9-nts.dll
or a relative path such as these:
zend_extension = ext\php_xdebug-2.2.3-5.3-vc9-nts.dll
zend_extension = ..\phpexts\php_xdebug-2.2.3-5.3-vc9-nts.dll
zend_extension = \dev\phpexts\php_xdebug-2.2.3-5.3-vc9-nts.dll
(The wizard will return zend_extension=.\ext\php_xdebug-2.2.3-5.3-vc9-nts.dll which includes the directory but also a superfluous .\)
If you want to activate zend*nts*.dll into you php.ini file on Windows servers, you must use zend_extension_ts directive instead of zend_extension
Example to load xdebug :
[XDeug]
zend_extension_ts="DRIVE:/PATH_TO_XDEBUG/php_xdebug.dll"
xdebug.show_local_vars=1
xdebug.default_enable=On
Note : the double quotes to your dll file
Hope that will helps someone :)
First of all In PHP 5.3 and later, you need to use only zend_extension, not zend_extension_ts, zend_extension_debug, or extension.
The php.ini file should look like this
[xdebug]
zend_extension="C:\xampp\php\ext\php_xdebug-3.2.0RC2-8.1-vs16-x86_64.dll"
xdebug.mode=debug
xdebug.client_host=127.0.0.1
Attention!! to avoid errors you need to install the correct xdebug library file.
For example, assuming you using windows and install this xamp version xampp-windows-x64-8.1.10-0-VS16-installer. The valid .dll xdebug file would be PHP 8.1 VS16 TS (64 bit) to download.
Do all the above and i guarantee no loading errors or problems
If you end up here while trying to build xdebug, then it means you have built it as a "static" extension (not a zend one).
You can use configure --with-xdebug=shared to build it as a shared extension (dll/so; you should see a table showing that xdebug is now configured to be built as a shared extension instead of a static one) so it can be loaded as a zend extension afterward.
I don't know if you can make a static zend extension.
Also, note that running the full test suite of xdebug requires to not activate opcache (configure --disable-opcache --with-xdebug=shared)
Worked for me: in php.ini
zend_extension = php_xdebug-3.0.4-8.0-vs16-x86_64.dll

XDebug is not loaded in PHP (Vista, Apache Module)

I downloaded php_xdebug-2.0.5-5.3-vc9.dll, added at the end of PHP.ini the following line:
zend_extension_ts="C:/Program Files/php5/ext/php_xdebug-2.0.5-5.3-vc9.dll"
When I use phpinfo(), xdebug is not loaded.
When I run command "php.exe -m", it not loaded as well.
How can this be resolved?
My configuration: PHP 5.3.1, Apache 2.2.14 with Apache Module, OS: Windows Vista
Both php and xdebug are thread safe.
This is somewhat similar with:
Apache not loading Xdebug, but does when started from the Command Line
EDIT:
I use VC6 dll and fixed configuration:
zend_extension="C:/Program Files/php5/ext/php_xdebug-2.0.5-5.3-vc6.dll"
Still can not find xdebug in phpinfo() output.
zend_extension_ts is deprecated on >5.3. Try it with zend_extension instead.
use zend_extension instead of zend_extension_ts
and look carefuly
"Compiler" , "Thread Safety" , "Architecture" and PHP Version
parameters in phpinfo()
example my php info say
PHP Version 5.3.1
Compiler MSVC6 (Visual C++ 6.0)
Architecture x86
Thread Safety enabled
so i used Xdebug 2.1.0 / 5.3 VC6 (32 bit)
You should probably not use the VC9 version, but the VC6.
For more informations, see the block "Which version do I choose?" in the left-sidebar of http://windows.php.net/ which states (quoting) :
If you are using PHP with Apache 1 or
Apache2 from apache.org you need to
use the VC6 versions of PHP
If you are using PHP with IIS you
should use the VC9 versions of PHP
Do NOT use VC9 version with apache.org
binaries
Also, quoting the Installation page of Xdebug's documentation :
From PHP 5.3 onwards, you always need
to use zend_extension and not
zend_extension_ts.
I have the exact same problem on Windows 7 too. It didn't work for me but perhaps for you it does. Xdebug has a special service page which helps you find out which version to download and what steps to take: http://www.xdebug.org/find-binary.php.
Following this didn't work for me unfortunatly. When I perform 'php -m' xdebug does not appear in the loaded modules list.
perform php --ini to check witch config file is loaded.
if you have something like this :
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Just copy your php.ini in windows directory ;)

Categories