Gary
Gary

Reputation: 2339

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.

Upvotes: 6

Views: 23817

Answers (6)

Elliott de Launay
Elliott de Launay

Reputation: 1168

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"

Upvotes: 2

na-98
na-98

Reputation: 889

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.

Upvotes: 0

David Lundquist
David Lundquist

Reputation: 690

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/

  1. Open up your command line and enter this:

    $ php -i

  2. 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 [email protected]. `

  3. Go the XDebug Windows Wizard https://xdebug.org/wizard.php and paste your PHPInfo in the big text box and submit.

  4. A new page will display with instructions and a "System Summary of your PHP. Carefully follow the instructions and select the Download link.

  5. Once you have modified your PHP.ini and observed where your "ext" folder is, copy your downloaded XDebug dll file to "ext" folder.

  6. 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)

Upvotes: 2

Ayaskant Mishra
Ayaskant Mishra

Reputation: 449

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:

  1. Check x64/x86 bit version.(Use x86 xdebug just to be safe)
  2. Check what version of PHP you are using.
  3. 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.
  4. 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.

Upvotes: 4

Floris
Floris

Reputation: 3135

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"

Upvotes: 0

Haider Lasani
Haider Lasani

Reputation: 169

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.

  1. Go to xDebug
  2. Dowload Xdebug 2.4.0rc1 (PHP 7.0 VC14 TS 32/64)
  3. Rename it to php_xdebug.dll
  4. Paste this file in "php/ext" folder
  5. Restart your server.

Now check your phpinfo()

In my case there were 64bit version so I've just changed to 32bit

Upvotes: 7

Related Questions