I'm trying to install xdebug on my ubuntu linux system.
Correct .so file, make install everything is correct, just maybe the php.ini configuration?
I use the installation wizard.
Installation Wizard Step by Step
I am at step 9, added the zend_extension on my INI file.
Added Zend Extension Command on other INI file.
when i PHP_INFO(), xdebug just does not appear in the list.
I googled around and seems other people php.ini file have this
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/tmp
but mine does not?
So i added those into my php7.4/cli/php.ini
still does not show on my phpinfo?
I go to the terminal and type php info xdebug seems there. xdebug support => enabled Version => 2.9.6
but i created a testpage.php and put phpinfo();
xdebug does not appear in the page?
Am i missing something?
Yes you need to update your php.ini file. Below is the code lines that i added in my php.ini file.
[XDebug]
zend_extension = "path of you extension example /usr/lib/php/xdebub.so"
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
Must restart your server after any changes in php.ini file.
Related
I have installed Xdebug on a Ubuntu 20.04 system. I followed this documentation , which I found to be quite well written, and got everything installed per the specs. (I used apt rather than yum, and placed the .so file into /usr/lib/php/20190902 folder rather than the document's example.)
In that document, there is a reference to adding to the php.ini file (I added to /etc/php/7.4/apache2/php.ini and /etc/php/7.4/cli/php.ini files). Since the article doesn't specifically mention "sections" of the .ini file, I put them within the [PHP] section. (This is consistent with the remark about putting right before the Quick Reference bit.) I restarted Apache2 and the phpinfo() output now includes Xdebug, which it did not include before. All well and good.
The trouble I'm having is that although I set xdebug.mode = debug in the php.ini files, the phpinfo() output tells me that xdebug.mode is set to develop. Consequently, Step debugger shows as Disabled in my configuration. I cannot see why.
These are the lines I've added to each of those php.ini files:
zend_extension=xdebug.so
#zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode=debug,develop,trace
[xdebug]
xdebug.remote_host=localhost
xdebug.remote_connect_back=0
xdebug.remote_enable=1
xdebug.remote_port=9900
xdebug.idekey="PHPSTORM"
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_handler=dbgp
xdebug.show_error_trace = 1
xdebug.log_level = 7
xdebug.start_with_request=yes
xdebug.mode=debug,develop,trace
And here are the key excerpts from the phpinfo() output:
On a whim, I tried placing all of those settings also within a new section of php.ini which I called [xdebug]. When that didn't work, I tried [Xdebug]. I restarted Apache2 after each attempt, but the symptom never changed.
What might I be missing?
For me, being on Ubuntu 22, PHP 8.1 and xdebug 3.1.2, the solution was to edit not the php.ini file but the xdebug.ini. For example :
sudo nano /etc/php/8.1/cli/conf.d/20-xdebug.ini
After this a restart for apache
sudo service apach2 restart
Then I was able see the changes in phpinfo and finally connect to PHPStorm debugger.
I have MAMP 4.5 on a Macbook High Sierra.
I just tried to enable xdebug, mainly to make var_dump() look more readable... and I was trying to get the orange-looking Errors.
I had this on another Computer before but can't get it working this time.
My active PHP Version is 7.2.1. (which php info tells me:
phpinfo tells me, /Applications/MAMP/bin/php/php7.2.1/conf/php.ini
)
I can find the php.ini file in /Applications/MAMP/bin/php/php7.2.1
but the other php.ini file I need to edit, which should be in /Applications/MAMP/conf/php7.2.1 is not there - the latest Folder is php7.1.12 - and editing this is not doing anything.
I have the following settings (in both files):
display_errors = On
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php7.1.12/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/Applications/MAMP/tmp"
I tried adding xdebug to my PHP. I download xdebug.dll from https://xdebug.org/download.php and adding this dll to the ext folder in my PHP. Then open php.ini from PHP directory and add these lines:
zend_extention="C:/Program Files (x86)/PHP/v7.2/ext/php_xdebug-2.6.0-7.2-
vc15-nts-x86_64.dll"
[xdebug]
xdebug.remote_enable=1
xdebug.remote_autostart = On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
and reboot Apach.
And when I run phpinfo() on this server there is no information about xdebug
I resolved my problem by renaming my downloading dll to xdebug.dll and adding zend_extension=xdebug in php.ini
Hello I have installed xampp, changed the php.ini to this:
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.3-5.3-vc9.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "C:\xampp\tmp"
So I created a php file:
<?php
phpinfo();
?>
Copy pasted the content and pasted in the xdebug wizard and got this output:
Tailored Installation Instructions
Summary
Xdebug installed: no
Server API: Apache 2.4 Handler Apache Lounge
Windows: yes - Compiler: MS VC9 - Architecture: x86
Zend Server: no
PHP Version: 5.4.7
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: yes
Configuration File Path: C:\Windows
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
Instructions
Download
Move the downloaded file to C:\xampp\php\ext
Edit C:\xampp\php\php.ini and add the line
zend_extension = C:\xampp\php\ext\
Restart the webserver
If you like Xdebug, and thinks it saves you time and money, please have a look at the donation page.
This tells me that it is not installed, so I followed the instructions and restarted the server. Opened the info php again, copied everything again and pasted it in the wizard again. Press the button and I get the exact same output, I don't know what I am doing wrong can anyone tell me what I do wrong?
Step 1: goto https://xdebug.org/wizard.php
step 2: copy and paste your phpinfo output to textarea which will be displayed on https://xdebug.org/wizard.php
step 3: click on analyze my phpinfo() output button, it will analyze your system and based on that it will give you suitable php_xdebug.dll file that you need to put at D:\xampp\php\ext folder
step 4: edit your php.ini file and add following line
zend_extension = D:\xampp\php\ext\your-php_xdebug.dll
step 5: Restart Server
Reference Video Tutorial : https://www.youtube.com/watch?v=HbJOP0YcSjs
complete video Tutorial for PHP Debug Example : Demo
Recent XAMPP version(mine is v3.2.2) already had the file php_xdebug.dll in xampp\php\ext folder , so we don't need go to https://xdebug.org/wizard.php for downloading the file.
Just open the file xampp\php\php.ini, add the codes:
[xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
Restart the XAMPP, then you could see the xdebug is working by type php --version in CMD:
Have you rectified the issue ?, if not please try this. I am having the same situations as yours, and I got result by
1)php.ini file content
zend_extension = "c:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9.dll"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
;xdebug.remote_host="localhost:81"
xdebug.remote_host=192.168.1.5
;xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
please place the above mentioned dll at c:\xampp\php\ext\
xdebug.remote_host=192.168.1.5 - This is the IPv4 address of my system, I changed to this because I couldn't debug with localhost and 127.0.0.1.
in NetBeans IDE, open Tools-> Options->PHP->Debugging. The values of debugger port and Session Id should match with the port and idekey specified in php.ini
Now save php.ini, restart Apache and now try for debugging
Thanks Johnson
I had the same problem and it was solved checking the versions of php and xampp: it turned out, xampp was 32 bits (installed in a 64 bits computer) and I chose the wrong version of xdebug (it has to be 32 bits).
As mentioned earlier, make sure your xampp installation doesn't already have php_xdebug file in the php/ext folder before downloading xdebug dll. If the xampp/php/ext folder already has a php_xdebug file, just add 1 line in the php.ini file
[xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
In general this extension come with the XAMPP package (look into your \xampp\php\ext folder) but it's not added to your php.ini automatically.
add this line manually into your php.ini
extension=php_xdebug.dll
It's all ;) that worked for me
My netbeans does not work the breakpoints using xdebug, my configuration looks correct, so I configured the first time I ran up to stop debugging the first time since then has never worked, someone had this problem? The version of my netbeans is 6.8 and the version of php is 2.5.2.
my php.ini:
zend_extension_ts = d:\wamp\bin\php\php5.2.5\ext\php_xdebug-2.0.2-5.2.5.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.profiler_enable=1
In my case this line needed to be included in the php.ini:
xdebug.remote_autostart=on
Here is the configuration section for XDebug:
[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.remote_autostart=on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "d:/wamp/tmp"
Checklist for xdebug:
Check that xdebug is loaded in phpinfo(), and the runtime value matches expected configuration.
xdebug.remote_enable is on.
xdebug.extended_info should be on for breakpoints to work.
xdebug.remote_port must be same as ide and unused.
xdebug.remote_handler is dbgp.
xdebug.idekey should be set to same as ide's key if xdebug.remote_autostart is on.
Sometimes it help to set xdebug.remote_host to intranet IP or computer name instead of local ip 127.0.0.1. PHP must be allowed by Firewall to connect to this host and port.
Setting xdebug.remote_log to a file will help in checking what is wrong. Disable the log once debug is working.
Sample config:
[xdebug]
xdebug.extended_info=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=on
xdebug.idekey="netbeans-xdebug"
Checklist for NetBeans:
Firewall must allow Netbeans to listen for connection with configured host.
Tools -> Options -> PHP -> Debugging, check port. Also check session id if xdebug.remote_autostart is on.
Project type must be PHP.
Project Properties -> Source, web root must be correct.
Project Properties -> Run Configuration, index file need to be a php (or empty) for Ctrl+F5 to work.
Project Properties -> Run Configuration -> Advanced, debug url should be "Default" or "Ask Everytime".
Project Properties -> Run Configuration -> Advanced, path mapping must be correct. (e.g. empty if there are no mappings)
(Most default options work out of the box, so if you are desperate try to delete and recreate the project.)
False Instructions, tested on PHP 5.5 and xdebug 2.2:
PHP output_buffering does not need to be off. (But may help in debugging)
OPCache (Zend Cache) module can be loaded.
xdebug.profiler_enable can be enabled.
Please edit this answer if you found something new.
Check that you have the right version of Xdebug for your version of PHP (including Thread-safe/non-thread-safe and 64bit/32bit).
In some newer versions of PHP, you need to use zend_extension, not zend_extension_ts, regardless of whether you have the TS version of Xdebug.
(I am replying with an Answer since the formatting in comments wasn't working properly)
Same happened for me: worked once and then stopped. However, I reached a point in my config where it started working without problems and I can share.
First I moved on top of php.ini the ioncube loader:
[PHP]
zend_extension=/Applications/MAMP/bin/php5/zend/lib/ioncube_loader_dar_5.2.so
Then I put these lines in the xdebug config:
[xdebug]
zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
And commented out all the lines about Zend Optimizer
[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3
;zend_optimizer.version=3.3.3
I work on MAMP, this is why the paths to my libraries are referred to my MAMP folder.
Good luck
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9.dll"xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"xdebug.remote_host = "localhost" xdebug.remote_port="9000" xdebug.remote_mode=req xdebug.trace_output_dir = "C:\xampp\tmp" xdebug.idekey="netbeans-xdebug"
this is working for me..
Here's how I was able to get it to work w/ mulitple PHP-FPM homebrew installations.
I used this excellent article for the multiple installations:
https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
In the comments of that post you'll see recommended how to install xdebug, bottom line:
brew install php56-xdebug
You have to install xdebug for each verions of PHP you have installed. Homebrew will make a xdebug.ini file for each version of php you installed. Each will have a path like:
/usr/local/etc/php/<version # i.e. "5.6">/conf.d/ext-xdebug.ini
This article installs DNSMasq which runs on xdebug's default port (9000), so you'll need to change the xdebug port to something else (9001 works fine.)
Edit the above mentioned ext-xdebug.ini file (or files if you installed more than one version of php.) Here's what works for me:
[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
; General config
; Dumps local variables on exception
xdebug.show_local_vars=On
; Dump server variables
xdebug.dump.SERVER=*
; Dump global variables
xdebug.dump_globals=On
xdebug.collect_params=4;
; Tracing
;xdebug.auto_trace=On
;xdebug.trace_output_dir= /opt/local/php_traces/
xdebug.show_mem_delta=On
xdebug.collect_return=On
; Debugging. You might need to specify your host with some additional options
xdebug.remote_enable=1
: from http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
The first two lines are all that is in the original homebrew file.
BTW - when I installed multiple PHP versions, this ext-xdebug.ini file was only created for the first PHP version I installed. I simply copied this file to the other PHP version locations, and changed the "php56-xdebug" part of the path in line 2 to reflect the proper php version.
Notice "xdebug.remote_port=9001"
Then in Netbeans (I'm using 8.02 Mac osX10.10.3) I use the following settings.
Go to Preferences->PHP->Debugging
Debugger Port: 9001
Stop at First Line: (unchecked)
Watches & Balloon Evaluation: (checked - there's a warning but it works fine for me.)
Also worth noticing is that in order for xdebug to show up using phpinfo() (or command line php -i) I need to restart apache with:
launchctl unload -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
sudo apachectl restart
launchctl load -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
For some reason my setup requires me to run this every time I startup. Kind of a pain, but I incorporated it in a shell command to easily switch between versions.
One more hint: part of brew info php56 says:
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using
the brew version you need to make sure /usr/local/sbin is before /usr/sbin
in your PATH:
PATH="/usr/local/sbin:$PATH"
Until I added this to my .profile_bash file, changes I made to each version's php-fpm.conf file were not recognized. Everything else seemed to work so it was confusing.
Hope this saves someone else time & trouble.
If you are still stuck you could try the following:
Download a new version of xdebug via the wizard (http://www.xdebug.org/wizard.php) and if you follow the instructions maybe you will be lucky.
Switching off the firewall might help.
Use a different port in netbeans, for instance in my case using 9001 in netbeans and 9000 in xdebug worked.
Add to php.ini file: xdebug.idekey=netbeans-xdebug.
Find out if you have a xdebug.ini file and add the xdebug related php.ini lines to that file.
Always make sure that you restart your apache service to test everything.
In my case - host is on another server, Net-beans 11 - I need to open terminal to remotehost
Window -> IDE Tools -> Terminal -> Remote Terminal
P.S. If u type export XDEBUG_CONFIG="idekey=netbeans-xdebug" in that terminal, and start debugging session, u can debug console scripts