Looking for some advice. Changed servers and I have setup Xdebug. PhpStorm detects it enabled, so does PHP, although I cannot get it to work.
(Firewall port opened, my firewall disabled, settings all configured, but I am getting nothing)
In order to identify the issue, I need to be able to see the Log of Xdebug, but I cannot get it to output anything. I tried it without a log file, then I have also created a log file and given Apache access to it, but still nothing.
I am running CentOS 8
Apache - Log_Debug enabled
Running on php7.3
PHP - track_erorr enabled.
/opt/plesk/php/7.3/etc/php.d/50-xdebug.ini
; Enable xdebug extension module
zend_extension=xdebug.so
xdebug.default_enable = 1
xdebug.idekey = "PHPStorm"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_host=123.123.123.123
(IP has been changed for obvious reasons)
Can anyone tell me why I cannot get Xdebug to write out any errors or connection attempts to: /tmp/xdebug.log
Here is my phpinfo() debug info:
Thanks for the comments, I didn't noticed Xdebug has updated its self.
After removing all previous reference i re-setup the the debug.ini
(I dont store custom ini settings in php.ini i reference them correctly)
Here is my updated xdebug.ini This works by using the browser Plug-in to enable to the Debugger mode
zend_extension=xdebug.so
xdebug.client_host = 123.123.123.132
xdebug.client_port = 9000
xdebug.connect_timeout_ms = 200
xdebug.force_display_errors = 1
xdebug.force_error_reporting = 1
xdebug.idekey = PHPStorm
xdebug.log = /tmp/xdebug.log
xdebug.log_level = 7
xdebug.mode = debug
xdebug.output_dir = /tmp
All default settings can be found here: https://github.com/xdebug/xdebug/blob/master/xdebug.ini
Related
I try to configure Xdebug Client for Sublime Text 3 on Windows 10 (with PHP Version 7.3.0 and 2.7.0RC2 Xdebug version).
I read issues for days because the panels context were always blank, but I solved it adding "super_globals": false in Xdebug.sublime-settings.
Now the Xdebug Context show:
The problem is the breakpoint never hits. never show me the Steps options (into, over). Even, don't show the little yellow arrow on left side.
I believe that it's related to path_mapping configure, but this really confuse me.
I dont understand why I need configure path_mapping if I work only on localhost on xampp.
php.ini:
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.7.0RC2-7.3-vc15.dll"
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.report_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_connect_back = 0
xdebug.idekey = sublime.xdebug
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.remote_log = "C:\xampp\php\tmp\xdebug.log"
You might need to add xdebug.remote_autostart = 1. Per the XDebug documentation:
xdebug.remote_autostart Type: boolean, Default value: 0
Normally you need to use a specific HTTP GET/POST variable to start remote
debugging (see Remote Debugging). When this setting is set to 1,
Xdebug will always attempt to start a remote debugging session and try
to connect to a client, even if the GET/POST/COOKIE variable was not
present.
See: XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Of course, restart your server after adding.
EDIT: See also Derick's answer on this StackOverflow page about using a log file to troubleshoot, if the above doesn't work.
I followed this steps, recommended by Xdebug based on phpinfo():
Download php_xdebug-2.4.0rc4-5.6-vc11.dll
Move the downloaded file to C:\xampp\php\ext
Update C:\xampp\php\php.ini and change the line
zend_extension = C:\xampp\php\ext\php_xdebug-2.4.0rc4-5.6-vc11.dll
Restart the web server
I also unchecked the 'ignore external connections through unregistered server configurations in PhpStorm. In PhpStorm port 9000 is configured. This port isn't used by an other application.
In the php.ini file I listed the following configuration:
[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.4.0rc4-5.6-vc11.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 = "localhost"
xdebug.trace_output_dir = "C:\xampp\tmp"
The DLL file exists.
I also enabled the debug functionality in chrome via the xdebug addon.
Which step do I miss?
You're probably going to want to set xdebug.remote_enable = 1 or the remote debugging will be disabled.
Also, set the remote debug port phpStorm is set to use:
xdebug.remote_port=9000 (I'm assuming port 9000, it's the default, but check phpstorm)
To debug every request (if you don't have the chrome plugin for a browser for example) use xdebug.remote_autostart = on
i'm using PHPStorm and trying to run Xdebug according this video https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20?autoplay=true.
First part works perfectly (https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/19?autoplay=true), but i'm stuck at second one.
Port 9000 was not working, so i changed it to 10000.
I configured PHP Web Application configuration
and after I press debug button, web is blank
and still loading and PHPStorm is waiting for incoming connection.
I have checked "can accept external connection" at PHP - Debug - Xdebug and xdebug in php.ini configured like this:
[XDebug]
zend_extension="/usr/local/Cellar/php56-xdebug/2.3.3/xdebug.so"
xdebug.remote_enable = 1
xdebug.cli_color = 1
xdebug.show_local_vars = 1
xdebug.remote_port = 10000
xdebug.remote_host= localhost
xdebug.remote_autostart = 1
xdebug.remote_log="/usr/local/tmp/xdebug.log"
xdebug.idekey = "PHPSTORM"
xdebug.ide_key = "PHPSTORM"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir="/usr/local/tmp/xdebug-profiler"
xdebug.profiler_enable_trigger = 1
I tried to validate web server with this result:
I was googling and trying solve this for 6 hours, try to help me please, i`m kind of dummy in this.
Using OS X El Capitan.
I can debug single script, but not a whole website.
When i run this directly online-chef.dev:10000, it says ERR_CONNECTION_REFUSED.
"online-chef.dev" is at local virtual host.
What I am doing wrong?
Thank you so much!
You are tried to debug web page through xdebug. For debug javascript you need install browser extention. This is manual for javascript debugging.
For javascript debug get current extention port and enter in this place:
For XDebug i don't want always click debug button, so i simple enable listen connections. This is manual for XDebug from JetBrains.
Here is my xdebug config that working with listen connections.
xdebug.idekey = "PHPSTORM"
xdebug.remote_port = 9001
xdebug.remote_mode = "req"
xdebug.remote_host = 10.0.2.2
xdebug.remote_handler = "dbgp"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.extended_info = 1
So, when i need debug javascript i click debug button. When i need debug php i just put breakpoint.
First set up debugging instruments often is hard, but it's pays off.
I have installed xdebug and tried to use it with phpstorm. But it doesn't want work correctly.
I tried to put following settings to /etc/php5/apache/php.ini and /etc/php5/mods-avaible/xdebug.ini:
zend_extension="xdebug.so"
; Debugging
xdebug.remote_enable= 1
xdebug.remote_port= 9000
xdebug.idekey = "PHPSTORM"
; Var-Display
xdebug.var_display_max_children = 2048
xdebug.var_display_max_data = 8192
xdebug.var_display_max_depth = 99
xdebug.max_nesting_level = 3000
I thought the `xdebug.ini should be the correct place for this settings.
Then I restarted apache with sudo service apache2 restart and opened a page where I print out phpinfo(). But as you can see on screenshot - it says all the time netbeans-xdebug.
What can I do? I searched my whole system for other php.ini files, but there aren't any other files.
This is what works for me.
zend_extension="/usr/lib/php5/20121212/xdebug.so"
[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.show_local_vars=0
xdebug.max_nesting_level = 500
But run following command first to locate xdebug.so
locate xdebug.so
and change following line accordingly
zend_extension="/usr/lib/php5/20121212/xdebug.so"
Solution to my problem.
I figured out that in my browser, even after restarting my system (obviously) a cookie XDEBUG_SESSION=netbeans-xdebug was causing this problem.
After deleting it and reloading my phpinfo() page, my new idekey is PHPSTORM and now xdebug works with my ide.
I think the problem was that I installed xdebug and tried it with my ide without setting it up - so (default?) value for idekey was this netbeans-xdebug value. And as soon as the cookie is set, it will ignore php settings as long as this cookie is alive.
It usually happens (if the path to xdebug.so is correct) because the remote_enable is set to off.
xdebug.remote_enable=on
might solve the issue.
I have xdebug working locally for 'normal' sites (I am using google chrome with xdebug helper and phpstorm to talk to a site hosted on a vagrant box).
However if I try and connect to a locally hosted api site (also on a vagrant box) using a REST client (google chrome's advanced rest client plugin) it will not work.
What settings do I need for xdebug on the vagrant box, and what additional information do I need to include when making api calls?
My settings (on the vagrant machine) which work for phpstorm and vagrant box are as follows:
;;;;;;;;;;;;;;;;;;;;;;;;;;
; Added to enable Xdebug ;
;;;;;;;;;;;;;;;;;;;;;;;;;;
zend_extension="/usr/lib/php5/20100525/xdebug.so"
xdebug.default_enable = 1
xdebug.idekey = "vagrant"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host=10.0.2.2
the idekey setting connects to a user defined application on phpstorm (see here: http://www.mailbeyond.com/phpstorm-vagrant-install-xdebug-php)
Through much striving managed to fix this with the help of #LazyOne
Here are my final settings if anyone else needs help:
XDEBUG FOR API
; Enable xdebug extension module
zend_extension=xdebug.so
; see http://xdebug.org/docs/all_settings
xdebug.max_nesting_level = 250
xdebug.max_nesting_level = 250
;for ubuntu
zend_extension="/usr/lib/php5/20100525/xdebug.so"
;for centos
;zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.default_enable = 1
xdebug.idekey = "PHPSTORM"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host=10.0.2.2
• Change symfony2 app_dev.php to:
//$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
$loader = require_once __DIR__.'/../app/autoload.php';
• May also need to put a breakpoint on the app_dev.php and try 'stepping into' the main project. This will prompt you to set up paths on the edit path mappings link: http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
• On REST client as a header: cookie XDEBUG_SESSION=PHPSTORM
You also need to include:
?XDEBUG_SESSION_START=PHPSTORM (e.g. /courses/?XDEBUG_SESSION_START=PHPSTORM)
as a parameter if using a REST client. PHPSTORM's client will add it automatically