1

Before anyone complains this is a duplicate question my setup:

OS X running VirtualBox with Linux and PHP 7.

I am trying to migrate from Eclipse to PhpStorm. Debugging works exactly as required with Eclipse, however I cannot seem to get it running with PhpStorm.

PHP ini:

[xdebug]
# see http://stackoverflow.com/questions/42656135/xdebug-breakpoint-fail for settings
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.remote_enable=true
xdebug.remote_host=192.168.56.1
xdebug.remote_port=10000#port 9000 is usually occupied by FPM, so I recommend to use a different
xdebug.remote_autostart=1
xdebug.idekey=

While attempting various changes it reports the below:

18:40   PHP Interpreter is not configured: Please configure PHP Interpreter to use built-in web server

18:54   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:54   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:54   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:54   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:54   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:54   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:57   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:57   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:57   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:58   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:58   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:58   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:58   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:58   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:58   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

enter image description here

Datadimension
  • 872
  • 1
  • 12
  • 31
  • 1) So .. what's exactly does not work (what errors/messages IDE shows you)? 2) What's your settings/IDE config? 3) Just in case: https://confluence.jetbrains.com/display/PhpStorm/Debugging+with+PhpStorm – LazyOne Jul 23 '17 at 18:38
  • Great point LazyOne, edited to show messages – Datadimension Jul 23 '17 at 18:45
  • 1
    So .. you do not see anything wrong in those messages? Like *"Can't start listening for connections from 'xdebug': Port 9000 is busy"* ?.. Hints: 1) You have configured xdebug (php.ini) to use port `10000` but IDE still tries to listen on `9000` port... Have you changed xdebug port in PhpStorm settings? 2) *"Port 9000 is busy"* -- that port is already listened by some another service (possibly your php-fmp) .. so IDE obviously cannot listen on that already-in-use port. P.S. Do not run more than one IDE at a time (in case if you have them both running) – LazyOne Jul 23 '17 at 19:11
  • LazyOne ... I find your answer both helpful and unhelpful as concurrent processes lol !!!! of course there are highlighted errors - thats what I am asking about. Basically how can I get PHPStorm to use xdebug at a given server/IP & port that is not local (ie on a VM at a given hosts definition or IP). IDE seems to ignore everything I have set, so deleted settings, restarted VM and host etc – Datadimension Jul 23 '17 at 19:37
  • 1
    To answer that .. I need to see your IDE settings. 1) Right now (based on the info you have provided so far) I may only say that you need to set xdebug port in IDE settings to match the port that you have set in your php.ini. I cannot give you any better suggestions without knowing what did you setup there. 2) The fact that IDE is unable to listen on Zend Debugger ports as well ... may suggest the general issue with local firewall .. or another app that already listens on those ports (my first impression, considering that ALL ports are busy, was that you have Eclipse running as well). – LazyOne Jul 23 '17 at 19:49
  • For #1 -- `Settings/Preferences | Languages & Frameworks | PHP | Debugging` (or just use search box -- type "xdebug" to narrow possible places in Preferences screen) – LazyOne Jul 23 '17 at 19:52
  • Thanks, and yes Eclipse was running at the same time, closed it but maybe it did not properly and hogged the port. This is evidenced by 502 server error until I restarted the whole OSX host system. Perhaps you could convert this to an answer so I can comment on it. Thanks for your help so far. – Datadimension Jul 23 '17 at 20:02
  • Solution in this enviroment with https://stackoverflow.com/questions/35921572/cannot-start-fpm-using-phpbrew-on-ubuntu/46106975#46106975 – Datadimension Sep 08 '17 at 00:41

1 Answers1

1

Change the phpstorm settings to use port 10000 for xdebug connections:

phpstorm settings screeshot

Stop/start listening for php debug connections to take it effect:

phpstorm stop start listening for php debug connections

If you still get "port busy" error, you can check what's blocking the port by running lsof -i tcp:10000 inside "terminal" (assuming you have OSX ElCapitan+).

PS: I also have xdebug.idekey=PHPSTORM in my xdebug.ini, phpstorm might ingore the connection without this after you resolve your port issue.

madpoet
  • 1,023
  • 11
  • 28
  • Many thanks, I have not had a chance to try this yet - could you confirm PHPSTORM can work remotely such as with VirtualBox on local machine or another real box on the LAN - their Sales people replied today that it could not ? – Datadimension Jul 25 '17 at 23:11
  • Yes sure I'm using it everyday with vagrant and at least once a month with our staging server – madpoet Jul 26 '17 at 05:51
  • PHPStorm thinks the port is busy, however the terminal check shows it free – Datadimension Jul 26 '17 at 12:53
  • IDE settings added above, I have managed to seem to get it to launch however it does not appear to listen on port 10000 or stop at breakpoints or indeed launch a browser. Screenshots added above. – Datadimension Jul 26 '17 at 16:33
  • The server runs a cron php, so I had disabled remote start, however when this is re-enabled the debug works and stops and breakpoints, so why can't I breakpoint it from IDE – Datadimension Jul 26 '17 at 19:13
  • Have you installed smt. like [xdebug helper extension](https://github.com/mac-cain13/xdebug-helper-for-chrome) or setup [bookmarklets](https://www.jetbrains.com/phpstorm/marklets/) to start/stop debugging? – madpoet Jul 30 '17 at 09:56