Error running script.php: Port 9000 is busy

Jacob picture Jacob · Oct 1, 2013 · Viewed 34.2k times · Source

I set php.ini and Debug config in phpstorm. Trying to debug php script outputs in phpstorm Event log with:

"Error running script.php: Port 9000 is busy"

end of php.ini:

        [XDebug]
        zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
        xdebug.remote_enable=1
        xdebug.remote_port="9000" (the default port is 9000)
        xdebug.profiler_enable=1
        xdebug.profiler_enable_trigger = 1
        xdebug.profiler_output_dir="/etc/php5/xdebug/profiler_output_dir"

Debug port in pStorm is also set on 9000. netstat -na outputs with:

tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN 

What if I set to other port. eg setting it to 10001 seems to do the job. Or just how to make it work properly. I am not sure if I understand how the xDebug works. Its like running Debug("script.php")(Shift+F9) in phpstorm with set breakpoint in file ?

Does somebody have an idea ?

EDIT:

From: http://xdebug.org/docs/remote

xdebug.remote_port
Type: integer, Default value: 9000
The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the client and the bundled debugclient. As many clients use this port number, it is best to leave this setting unchanged.

What if I change port for other than 9000 ? Maybe something over 50k .

Answer

Philipp Michael picture Philipp Michael · Mar 1, 2016

The process, which is running on port 9000, could be PhpStorm itself.

Check the currently used ports like Jacob mentioned (on Windows cmd: netstat -a -b): enter image description here

If PhpStorm.exe ist listed under :9000 you just have to change the port of built-in server in settings > Build, Execution, Deployment > Debugger to e.g. 63342 (this was the default setting of my teammates PhpStorm installation).