PHP Xdebug runner fails to debug scripts

runner
xdebug
php

#1

Hello again. Configured custom runner as shown below:

{
    "cmd": [
        "php",
        "${debug?-d}", "${debug?xdebug.remote_enable=1}",
        "$file",
        "$args"
    ],
    "selector": "^.*\\.(php|phar)$",
    "info": "Running PHP script $file",
    "working_dir": "$project_path",
    "debugger": "xdebug",
    "debugport": 9000,
    "env": {
        "XDEBUG_CONFIG": "\"idekey=cloud9ide remote_host=localhost remote_port=9000 remote_mode=req\""
    }
}

but debugger fails to stop on breaking points ((


#2

this is exactly the default php cli runner which normally works.
Do you run this on ssh or hosted workspace? Is the debugger enabled (the green button before runner name).


#3

Working in a workspace. Debugger is enabled. Still no breakpoint handling ((


#4

Looks like there is a problem with quoting in the runner,
version without quotes in XDEBUG_CONFIG should work

"XDEBUG_CONFIG": "idekey=cloud9ide remote_host=localhost remote_port=9000 remote_mode=req"

#5

Removing quotes from the runner’ string you provided results in error “Unexpectd token remote_host”


#6

do you mean

{
    "cmd": [
        "php",
        "${debug?-d}", "${debug?xdebug.remote_enable=1}",
        "$file",
        "$args"
    ],
    "selector": "^.*\\.(php|phar)$",
    "info": "Running PHP script $file",
    "working_dir": "$project_path",
    "debugger": "xdebug",
    "debugport": 9000,
    "env": {
        "XDEBUG_CONFIG": "idekey=cloud9ide remote_host=localhost remote_port=9000 remote_mode=req"
    }
}

gives that error?
only inner quotes \" need to be removed not the outer ones


#7

This case (without any quotes) gives token error:

XDEBUG_CONFIG: idekey=cloud9ide remote_host=localhost remote_port=9000 remote_mode=req

…and this case also:

"XDEBUG_CONFIG": idekey=cloud9ide remote_host=localhost remote_port=9000 remote_mode=req

And finally after all these attempts to edit quotes in runner file, debugger switches to “Auto” each time I run it on php scripts((


#8

yes, without any qoutes it is not valid json, use the version from my answer


#9

code from your answer results in Process exited with code: 255
and STILL no stops on breakpoints ((