Reload page or rerun script during debugging inside of phpstorm
I am getting started with debugging in phpstorm, but encountered a problem. It seems that I cannot reload the page in the IDE itself – I have to manually go to the browser and reload the page.
I CAN setup a run configuration that maps directly to the url that I want to use, and I can reload this configuration easily, but changing this each time would be tedious. (I'd prefer it if the debugging url was automatically set based on incoming debugging session.)
I am using a a basic mvc configuration with a front controller, all routed through an index.php, so the page I am reloading does not directly map to the file I am using. For example, if I want to debug a specific user's configuration by paying attention to variables within a User class, I might go to the url 'localhost/users/user1'. But if I want to debug user2's configuration, I would need to create a second run configuration for url localhost/users/user2, to allow easy reloading within the IDE (despite debugging the same code, the User class).
Is there any way for phpstorm to detect the url the browser is using when a debug request is sent and create a temporary run configuration for the debug session based on that url, so that I do not have to edit a run configuration for each url I am editing? Or some other solution?
My project is entirely local – no symlinks, etc.
Please sign in to leave a comment.
Do I get right that reloading the page via browser is something you'd like to avoid to save some amount of clicks?
Currently, there's no way to achieve what you want. Where do you think should PhpStorm take the URL, from the browser directly or from $_SERVER['REQUEST_URI'], or something else?
You have it exactly right - this is about not having to go back to the browser to reload a url, or create a run configuration for each url I want to debug.
I don't have any suggestions on how to actually implement this (I am new to this sort of debugging and actually just assumed that I was missing something), but thanks for confirming for me that I am not overlooking something. I would request that some feature that allows this behavior be added, so that debugging within PHPStorm became a bit less setup-intensive for each debugging session.
Just to confirm, this is my work flow:
1 Set a break point in phpstorm,
2 load the the url in the browser
3 switch back to phpstorm and edit code
4 reload the browser
5 switch back to phpstorm and edit code
repeat 4 and 5
My preferred workflow would be:
1 set a break point in phpstorm
2 load the url in the browser
3 switch back to phpstorm
4 edit in phpsorm
5 reload in phpstorm
repeat 4 and 5
If I am working on a page that is not dynamic (or I am not testing dynamic features of the page), the work flow would be:
1 create a run configuration for the url
2 load the url in phpstorm
3 edit in phpstorm
4 reload in phpstorm
repeat 3 and 4
This last workflow is very nice but requires an explicit run configuration to be made.
I often have to debug many pages at once, so creating a run configuration for each - especially dynamic pages like /user1, /user2 - can be fairly tedious.
If my work flow is an unexpected or unintended workflow, please let me know. As I said, I am new to this sort of debugging.