How to debug PHP application

php

#1

Hi,

How do I debug a PHP app? I press RUN and it loads apache and everything works, but nothing works in the debugger itself. Tried to put variables in watch, etc


#2

Hi,

Did you use a breakpoint to stop the execution of your application? If so, can you confirm if your code is entering the place where the breakpoint was positioned? Also, please confirm that the debugger is activated: you can see that it is by the green bug button on the run panel.

Regards,
​Mutahhir


#3

I don’t know what happened, but I can’t use debug with PHP anymore… :cry: Every time it uses “shell command” and of course it crashes. I can’t find “php” option in the run menu.

What’s really strange is that it worked a few weeks ago!

I even remove and reinstall php5-xdebug package, but nothing works.

Any hints.

Thanks!


#4

Hi,

In order to use PHP, please select the Apache httpd (PHP + HTML) runner from the runners dropdown list.

Can you let me know if this resolves the issue?

Regards,
​Mutahhir


#5

Hi,

Thanks for your answer.
Unfortunatelly, there is the issue… The entry does not appear in the list… :sweat:

Antoine


#6

On which workspsace do you see that?

both apache php and php web server should work


#7

Hi
I added a breakpoint, but the application runs as regular. It does not stop at the breakpoint (I tried lines which it executes for sure).
Run->Show debugger at Break is enabled


#8

you need to toggle debugging on by clicking on the grey bug shaped button near the runner name


#9

Also note that the file won’t run until you actually access it on the server by going to the URL where it’s hosted. Otherwise, the server will start but the file will never run because it’s just sitting there waiting to be served. Once you access the page, it will hit the breakpoint.


#10

I got it to work, but its still inconsistent. A lot of times I have to stop the server and restart, or reload the whole environment. Usually it stops on the first time in the breakpoint but not in the next times I access the page


#11

Thank you for following up about this. Can you record a screencast so I can see exactly what’s going on? Then we can look into making the whole experience much more clear.


#12

Hello,

I am facing the same problems - mentioned in this thread - with debugging in cloud9. If you are willing to contact me, I would love to have a skype call about the debugger.

Kr,

Gregor


#13

Is there a solution for that problem? I have exectly the same issue. Sometimes the debugger is working sometimes not.


#14

Hello,
I am also having a problem getting php debugging to work.

The application runs fine with debugging off, but when I try with debugging (Stop server; click to make the bug icon green; start server)
I reload the same page that worked and get the ‘No application seems to be running’ page.

I’ve tried this with both the apache and the php server .

Any ideas on what I can do?

Thanks,
-Chris


#15

I solved this problem by uninstalling php-xdebug with --purge, then I reinstalled it via PECL following these instructions: https://xdebug.org/docs/install#configure-php

pecl install xdebug
You still need to add the correct line to your php.ini: (don’t forget to change the path and filename to the correct one — make sure you use the full path)

zend_extension="/usr/local/php/modules/xdebug.so" <= you need this line

Note: You should ignore any prompts to add “extension=xdebug.so” to php.ini <= you DON’T need this line. If you find it in config files, remove it or comment ir.