Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to debug state of a running application being requested via HTTP #39

Closed
benglass opened this issue Jan 21, 2014 · 13 comments
Closed
Labels

Comments

@benglass
Copy link

I am curious if there is a way or plans to support the ability to use the Debug functionality and have it triggered from an HTTP request to your application.

For example I want to be able to visit http://www.myapp.com in my browser (or event via a curl request/wget from the terminal would be fine) and still take advantage of the Debug functionality where I can explore he state of my app.

This would be similar to xdebug functionality minus the step debugging.

@bobthecow
Copy link
Owner

In PHP 5.4+ you can run your application using the built-in CLI SAPI web-server. PsySH works great with that :)

@gonzalo123
Copy link

Django has one cool feature that I think we can create with psysh. In error pages ther's an interctive console. The same than psysh but in the browser instead of server's console.

I think if instead of read/write from stdin, if we use a websocket connection (for example with Rachet) we can move the interactive console to the browser. Maybe I need to think about it a little bit more, but it should be possible.

@hason
Copy link
Contributor

hason commented Jan 24, 2014

The same request in symfony/symfony#10094 and experimental implementation for the Tracy nette/tracy@59d9c81 - see in action http://vimeo.com/72138480

@kor3k
Copy link

kor3k commented Mar 6, 2014

@bobthecow please can you tell exactly how to make it work?

i have a simple php file with just autoloading and \Psy\Shell::debug call.
but when i run the php built-in cli server and request that file via http, the cli starts indefinitely flooding with errors:

[Thu Mar 06 17:02:25 2014] PHP Notice:  Use of undefined constant STDIN - assumed 'STDIN' in C:\wamp\www\ratchet\vendor\psy\psysh\src\Psy\Readline\Transient.php on line 102
[Thu Mar 06 17:02:25 2014] PHP Warning:  fgets() expects parameter 1 to be resource, string given in C:\wamp\www\ratchet\vendor\psy\psysh\src\Psy\Readline\Transient.php on line 102

@bobthecow
Copy link
Owner

@kor3k that seems like a different issue... can you run psysh normally?

@kor3k
Copy link

kor3k commented Mar 6, 2014

@bobthecow yes, in cli it works like a charm. php version is 5.5.10-win64-ts

@bobthecow
Copy link
Owner

@kor3k do you mind opening a new issue for this with as much information as you can?

@kor3k
Copy link

kor3k commented Mar 6, 2014

@bobthecow #54

@CMCDragonkai
Copy link

One way would be making psysh launch a simple TCP server just listening of any random port. Then as part of Monolog, you can write a psysh handler that pipes the logs to psysh, allowing you to see the logs in real time but also not affecting your application (unlike Tracy). Kind of like how Firebug currently works, but in this case, no need for a browser. A simple Curl/HTTPie is good enough to trigger requests.

@ghost
Copy link

ghost commented Apr 23, 2014

@bobthecow It works with the built-in web server, however when hitting ctrl-d the request doesn't continue (the browser is still waiting for answer from the server). When launched from the command line it works as expected (the PHP script is resumed when hitting ctrl-d)

@bobthecow
Copy link
Owner

@gpoulin2 Hmm. That's either a regression or an issue with PHP versions or something. Do you mind opening another issue for that?

@Markcial
Copy link
Contributor

Hi, i saw an open issue on the symfony component for this, would be nice to have a web debugger with stack trace. Is there any PR started on this, should i start from scratch? is there anyone who had tried something with that? thanks

@bobthecow
Copy link
Owner

Closing this one in favor of #505 since they're substantially similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants