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
Related
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
I am trying to set a zero-configuration debugging for PhpStorm/Docker/Xdebug.
Xdebug is installed properly (I can see it loaded on phpinfo()):
My PhpStorm setup for debugging is standard, listening on port 9000. Here is the xdebug config I'm using:
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = docker.for.mac.localhost
xdebug.remote_port = 9000
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_log = /var/log/xdebug.log
xdebug.idekey = "PHPSTORM"
Off topic: I am also wondering if using xdebug.idekey is the same as providing IDE key through Chrome extension?
When I click on PhpStorm to start listening for connections, and set in the configuration to break on first line, I am getting the following:
Looking at Xdebug logs, it is clear that container connected to client (which is also clear from the fact that I am getting an error when trying to debug).
At this point, I have no manual servers or remote debug configurations set up.
If I define a server and remote debug configuration, and set environment key:
environment:
- PHP_IDE_CONFIG="serverName=docker-server"
And then if I click to debug:
Debugging then works, and no errors appear.
But this is then not a zero-configuration debugging...
What am I doing wrong?
I have a problem debugging PHP with PhpStorm. I have container, and it is running Ubuntu 18.04.2 LTS and my host machine is macOS 10.14.5. I added configuration to PhpStorm, but breakpoint is not hit.
So, this is my xdebug.ini configuration:
zend_extension=xdebug.so
xdebug.max_nesting_level = 250
xdebug.remote_port = 9000
xdebug.idekey = "XDEBUG_ECLIPSE"
xdebug.remote_host = "192.168.1.144"
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
xdebug.var_display_max_depth = -1
# Enable the debugging on request
xdebug.remote_enable = on
xdebug.remote_autostart = off
# enable logging
xdebug.remote_log=/tmp/xdebug.log
When I run php -m -v, I can see under Zend Modules that Xdebug is enabled/installed. My php version is PHP 7.1.32.
192.168.1.144 is the IP of my host machine. I also checked that PhpStorm is configured to listen on port 9000
When I created new configuration, I set IDE key(session id) as XDEBUG_ECLIPSE, also, when I defined server under configuration, host is correct (dummy.test), port is set to 80, and Debugger is set to Xdebug.
I also ran command tail -f /tmp/xdebug.log, and when I refreshed the page, there wasn't any new entry in the log file.
Any idea what am I missing? I set up breakpoint to one index function of xy controller and is not hit, I also enabled break at first line in PHP script.
so, with help of the topic owner it was found that for Mac host.docker.internal is set doc
as a hack-solution host ip was added to /etc/hosts inside docker container:
host-ip host.docker.internal
probably there should be a better solution :)
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 to debug an application (let's call it App A) that communicates with a Magento store through API v1 (via a Zend_XmlRpc_Client).
Here's how XDebug is configured on my php.ini.
xdebug.remote_enable = 1
xdebug.remote_host = 10.0.2.2
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
xdebug.trace_enable_trigger = 1
xdebug.trace_output_dir = "/var/www/xdebug_profile"
xdebug.profiler_enable_trigger = 1
;xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/var/www/xdebug_profile"
xdebug.remote_log = "/var/www/xdebug_profile/xdebug.log"
When I go to my Magento store through my browser and enable debugging (using Xdebug chrome extension), I can debug my Magento store.
I would like to do the same thing from my App A. I want to access to my App A through my browser and be able to debug the Magento code that is executed through API calls. I tried to pass a cookie to the XML RPC client this way (following this article: http://inchoo.net/magento/magento-xdebug/ ) :
$xmlrpc_client->getHttpClient()->setCookie('XDEBUG_SESSION', 'PHPSTORM');
But it's not working. I also tried XDEBUG_SESSION_START for the cookie name, I tried to pass ?XDEBUG_SESSION_START=PHPSTORM at the end of the URL that my client calls and it's not working either.
FYI, I'm using a vagrant environment, both applications are using the same IP. Here's the content of my /etc/hosts file :
<my_vagrant_ip_address> dev.mysuperstore.com dev-app-a.mysuperstore.com
Any help is highly appreciated !
Just add ?XDEBUG_SESSION_START=filter_string at the end of the url
https://{{url_magento_test}}/rest/default/V1/task_blogext/posts?XDEBUG_SESSION_START=PHPSTORM
All you need to add for get working debug is to add this lines in xdebug.ini and to connect it:
zend_extension=xdebug
[xdebug]
xdebug.mode=debug
xdebug.client_port=9000
xdebug.client_host=host.docker.internal
xdebug.discover_client_host=1
After this, install chrome extension debug helper, and press in it debug mod. And all will work great.