PHP XDEBUG not getting enabled - php

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.

Related

XDebug configured and installed but not working

I followed instructions how to install xdebug.
So, I created file with phpinfo() function, that returns me php info.
Then copied php info and used xdebug wizard: https://xdebug.org/wizard
That returns me:
I followed instructions, so I downloaded .dll file , moved it to location. Edited php.ini file as said but result is still Xdebug installed: no
Also I restarted apache server on my xamp control panel.
I figured out what's the problem...
I downloaded non treat safe file, so i just downloaded tred safe file and replaced nts.
Just copied name of new (tread safe file) and paste it in php.ini file like:
zend_extension = "C:\xampp\php\ext\php_xdebug-3.0.3-8.0-vs16-x86_64.dll"
As you can see, the old wan was:
zend_extension = "C:\xampp\php\ext\php_xdebug-3.0.3-8.0-vs16-nts-x86_64.dll"
So, be careful wich one file you downloaded because names are very similar. :D
On image I higligted correct version:

xdebug 2 with PhpStorm setup error

I have been dealing with an unexpected error when trying to setup xdebug 2 with PhpStorm (2016.2.2). It says:
Connection with 'xdebug 2.5.0rc1' was not established. Validate installation.
I decided to ask for help because I cannot solve this error for 3 days already and I have tried everything I could.
These are the setup steps that I did:
pasted my phpinfo here (https://xdebug.org/wizard.php) and downloaded the recommended php_xdebug.dll (php_xdebug-2.5.0rc1-5.5-vc11-nts-x86_64).
copied php.ini file into bin\php\php5.6.0 and added these lines of code:
[Xdebug]
zend_extension = C:\MAMP\bin\php\php5.6.0\ext\php_xdebug-2.5.0rc1-5.6-vc11.dll
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.remote_port = 80
xdebug.profiler_enable=1
Installed "JetBrains IDE Support" and "Xdebug helper" extensions for Chrome browser.
Sometimes I manage to debug (I guess) without an error but I get an error on browser which says "No direct script access allowed".
I am on Windows 10 x64 running MAMP 3.2.2 with php 5.6.0. Don't know what more details I can provide right now but it looks enough.
The problem that I had was on the other laptop that I use. Both of them use the same settings (win10, MAMP 3.2.2). On my second laptop (the one I am currently typing from) this is php.ini settings:
PHP version: 5.6.0 PHP CLI: C:\MAMP\bin\php\php5.6.0\php.exe PHP CGI:
C:\MAMP\bin\php\php5.6.0\php-cgi.exe Loaded Configuration File:
C:\MAMP\bin\php\php5.6.0\php.ini Debugger extension: xdebug 2.4.1
It uses xdebug 2.4.1 and I dont get the error on this laptop. I will try to get the same xdebug version to my first laptop and see if it works.
And this is the only command I added to php.ini on the second laptop (xdebug functioning) "zend_extension = C:\MAMP\bin\php\php5.6.0\ext\php_xdebug-2.4.1-5.6-vc11.dll" . Does it even make sense that without extra Xdebug settings it could even run?

Problems installing xdebug.so extension on local AMP environment

Edit: I've now removed the version of xdebug.so I installed manually, and installed XDebug via Homebrew. When I type "php -i" at the command line, xdebug appears to be installed; but when I run phpinfo(), there's still no sign of XDebug.
I've just got a new Mac so, like every time I buy a new Mac, I have rebuilt my local web development environment (this time, following an amazing tutorial: https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew)
Everything has gone smoothly until I got to installing the XDebug extension. I use Komodo as a development environment so, as I've always done in the past, I followed the instructions here: http://docs.activestate.com/komodo/7.1/debugphp.html#debugphp_top
I followed the instructions to the letter, but I can't get xdebug.so to appear in my phpinfo.php() page. Here's what I did:
Created a phpinfo.php file so that I can find the correct php.ini file
Checked that phpinfo.php file and found that the "Loaded Configuration File" is "/usr/local/etc/php/5.6/php.ini"
Edited that php.ini, adding the following lines to the bottom of the file:
_
zend_extension=/usr/local/Cellar/php56/5.6.14/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=<idekey>
; You may also want this - to always start a remote debugging connection.
;xdebug.remote_autostart=1
Ran "brew services restart httpd22" (and, just to be sure, "sudo apachectl restart")
When I go reload phpinfo.php, it contains to reference to xdebug.so.
I can confirm that xdebug.so is present at /usr/local/Cellar/php56/5.6.14/lib/php/extensions/no-debug-non-zts-20131226 and that /usr/local/Cellar/php56/5.6.14/lib/php/extensions/no-debug-non-zts-20131226 is set as the "extension_dir" in php.ini.
What am I missing?!
Ultimately this proved be to be caused my me doing things in the wrong order. I'd used Homebrew to install Apache and PHP, but I'd installed Apache 2nd: this meant that it wasn't set up to work with the version of PHP I then installed.
I reinstalled PHP using the command brew reinstall php54 --homebrew-apxs, and that ensured that Apache and PHP were talking to each other.
Then, to install xdebug, I ran brew install homebrew/php/php56-xdebug. After restarting Apache, XDebug showed up in phpinfo() straight away!
Then I had to get XDebug talking to Komodo. To do this I added in the config lines from my original post to the specific xdebug config file that had been created during the Homebrew install (mine was located at /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini), and then made sure that Komodo was listening on the correct port (9000 didn't work, so I changed to 9001).

Zend Debugger Extension Is Not Loading Correctly

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

No xdebug in phpinfo()

I have added following lines into php.ini
[XDebug]
zend_extension = C:\PROGRA~1\PHP5\ext\php_xdebug-2.1.0-5.3-vc9.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
Version of php_xdebug-2.1.0-5.3-vc9.dll is obtained via page http://www.xdebug.org/find-binary.php.
But there are no any mentions of 'xdebug' string in output of phpinfo().
What can be wrong?
(This is my second fight with php-xdebug to get working, first time I gave up. If you have other suggestions concerning debugging please add them also, possibly as comments to the question. I would like to following scenario work under windows: "Set up break point, run my script, it stops on break point and I can see the value of some variable". Thanks)
UPDATE
Restart of Apache does not resolve the issue.
In log file the message appears:
Apache/2.2.14 (Win32) PHP/5.3.1 configured - resuming normal operations
check the top of the output of
php -m
for me it showed an error in php.ini, after solving that xdebug was loaded.
zend_extension = C:\PROGRA~1\PHP5\ext\php_xdebug-2.1.0-5.3-vc9.dll
should be replaced by
zend_extension="C:\PROGRA~1\PHP5\ext\php_xdebug-2.1.0-5.3-vc9.dll"
P.S. Will e-mail xdebug guys.
This worked for me (vscode, xampp)
Go to https://xdebug.org/wizard.php and paste the contents of phpinfo()
Then download the right xdebug.dll and place it in your 'ext' folder.
Add the following to your php.ini
[XDebug]
zend_extension="php_xdebug-2.5.4-7.0-vc14.dll"
xdebug.remote_enable=1
xdebug.remote_autostart=1
I just had the same problem, nothing of this worked for me.
I started php in the console and I saw, php was unable to load the dll from the given path.
The solution for me was to omit the path information and only load it like this:
zend_extension="php_xdebug-2.2.5-5.5-vc11.dll"
You can follow this tutorial on getting started with xdebug : http://devzone.zend.com/article/2803-Introducing-xdebug
Xdebug and ZendDebug are two separate debuggers, it's up to you to decide which one to use. Either one is pretty easy to setup. Only a couple of steps in Eclipse.
Post the content from your php info page into this page to find out which version to download : http://www.xdebug.org/find-binary.php
I was just struggling with this myself and found a way to identify (and solve) the problem. It works on Xampp and Windows 7 at least.
In my case the problem was dots. Renaming "php_xdebug-2.2.5-5.5-vc11.dll" to "php_xdebug.dll" did the job.
Another pro-tip is that newer versions of Xampp have Xdebug built-in, so you don't need to donwload it, just edit php.ini with:
zend_extension = "path\to\php\ext\php_xdebug.dll"
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1 (or localhost)
xdebug.remote_port = 9000
xdebug.remote_mode = req
Then restart the apache and it should work. The advantage of using xampp built-in xdebug is that it's most likely the right version.
Writing in January 2019, I found that following the Xdebug Wizard at Xdebug wizard here
exactly, including using their download link to the correct version of Xdebug for your version of PHP and copying the line to insert on your php ini exactly as is, got Xdebug appearing in phpInfo for me. I was installing into Laragon . Running php -m from the command line gave a good confirmation of all being well, with Xdebug loading as a Zend Extension. Usual gotchas about needing to restart server etc apply.
In my case, Xdebug is showing in php -m, php -i but not in phpinfo() result.
Restarting Apache didn't help until restarting php-fpm
systemctl restart php-fpm.service
Its happen because of permission.
you have to add the permission of that specific app/user profile from the folder's Properties Security tab.
I use PHP with IIS server so.
It worked for me by adding IIS_USER in security permission.
in my case the issue was the php.symlink file in the C:\wamp64\bin\apache\apache2.4.23\bin folder , this file links to the php.ini file existed in C:\wamp64\bin\php\php5.6.25 but apparently it wasn't working so i've deleted it and copy paste the actual php.ini to the same folder and it worked.
if you want to return the php.symlink back open cmd in the
C:\wamp64\bin\apache\apache2.4.23\bin and write the following (windows):
mklink php.ini C:\wamp64\bin\php\php5.6.25\php.ini
replace the path to point to your php.ini inside your php file
Just for the newbees:
If you want to check if the .dll, specified in the php.ini is loading properly:
Add php to the Windows Runtime Directory. For win10, refer to this post https://www.forevolve.com/en/articles/2016/10/27/how-to-add-your-php-runtime-directory-to-your-windows-10-path-environment-variable/
From the Windows command prompt, type php -m and check if any error is displayed.
In my case the issue was the file path which apache loaded, the file php.ini I changed is not the current loaded config, so check it First.
xdebug appears in "php -m" command line BUT nothing on the browser <?php phpinfo(); page !
Check in httpd.conf PHPIniDir "C:/to/the/RIGHT/phpversion"
The command line php.exe use the Environment PATH variable but nut the apache !

Categories