Search code examples
phpsublimetext3sublimetextxdebug

How to fix "Unable to start Xdebug debugging session" in Sublime Text


I am trying to use Xdebug in Sublime Text 3 in Fedora 31, but when I start debugging I get this error:

Unable to start Xdebug debugging session. 
Errno 13 Permission Denied

I installed xdebug as a prerequisite, which appears in phpinfo as well. Here is the output:

This program makes use of the Zend Scripting Language Engine: Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.9.0, Copyright (c) 2002-2019, by Derick Rethans
    with Zend OPcache v7.3.13, Copyright (c) 1999-2018, by Zend Technologies

Here are the xdebug settings in php.ini:

[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 81

I already give 777 permission to /usr/lib64/php/modules/xdebug.so but I'm still getting the same error.


Solution

  • Port 81 (and anything under 1024) is only available for the super user (root) to use. You need to configure a port number higher than 1024, for example, the default of 9000, or perhaps 9003 if 9000 is already in use.

    You need to change this both in php.ini (xdebug.remote_port=9003) as well as in the Sublime settings.