문제

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

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top