CodeIgniter and PHPStorm - Need some Debug Help
HI - I'm very new to Storm, however, I have now got Xdebug running from Firefox and debugging an ultra simple script. ( Thanks Andrij !)
However, my real goal is to use Storm to debug a Codeigniter application I am working on. When I run Xdebug from FF I get this consol message:
"No direct script access allowed"
Ok - I know what this means ie my controller will not allow access to a file unless it knows where it comes from - stopping people from bookmarking file pages and trying to get to them afterwards.
Ok - so I commented it out and then I get:
C:\xampp\php\php.exe -dxdebug.remote_enable=1 -dxdebug.remote_host=127.0.0.1 -dxdebug.remote_port=9000 -dxdebug.remote_mode=req C:\xampp\htdocs\JSD\application\controllers\welcome.php
Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\JSD\application\controllers\welcome.php on line 3
Call Stack:
0.0660 134208 1. {main}() C:\xampp\htdocs\JSD\application\controllers\welcome.php:0
Process finished with exit code 255
Thanks for any advice !
请先登录再写评论。
Hi vincent,
It should work just fine when using Bookmarklet and Listen button.
What kind of URL you are trying to debug? If it is "normal" URL (e.g. the one you clicking on a page) then you should not see such message at all, as request will be routed properly trough CI.
I've tried to debug CI demo app quite a while ago (maybe a year ago, I would say) and it worked with no issues:
1. Set breakpoint(s) where required
2. Turn on "Listen for PHP debug connections" button
3. In browser, navigate to the page you want to debug (or page 1 click away)
4. Activate debug session via Bookmarklet
5. Refresh the page (or click the button/link to the target page)
Are you trying to debug web app (accessible via browser) or console app.
The message above clearly states that:
To sum it up -- you doing it completely wrong.
HI Andriy
thanks for your rapid reponse and for helping out ! I am very new to storm.
My work flow is:
- set a break point in the controller / function I want to examine - this is well past the index.php page. The controller receives a collection of POST variables from a view. I want to see the POST values.My work flow is:
- I turn on the 'listener'
- turn on the debugger from within Firefox
- reload the html page(view) where my form collects the POST vaiables
- Storm reponds and I accept the connection from my app.
- Boom : Fatal error: Class 'CI_Controller' not found.
So, if the console is saying I am connecting through the CLI, am I still configured wrong ? ... I think I connected things up the way the various user gudes stated.
Secondly - how do I check the values of POST variables from a html form deep inside the app, if I start the debugger from FireFox and Index.php ??
Sorry fro such newb questions ... but I am getting there ... slowly
Thanks Vince
You just put breakpoint where you want it to stop -- so even if request will go trough index.php, but breakpoint in /app/controller/welcome.php, it will stop/break in welcome.php file -- it will go trough index.php completely.
Forget that you are trying to debug something. Try to run your app without debug in the same manner you are doing it now -- you will have the same error because application workflow is completely broken. Instead you should use normal flow, as if you are the normal user of your app, then just add "debug" bit (e.g. activate Listener or Bookmarklet only when you need to debug).
So .. if URL for your welcome.php is mysite.com/welcome, then you should debug that URL and not mysite.com/app/controller/welcome.php
If you go to "Run | Edit Configurations..." you will see your Run/Debug configuration there, which will be of "PHP Script" type (which is to run local php scripts in CLI mode). If you want to do debug web app by using Run/Debug configuration approach (which you do not really need to do since you already using bookmarklet and Listen button), then you need to create an entry of "PHP Web App" or "PHP Remote Debug" type (they have some differences -- you can check Help for details).
I think you should just stick to the workflow described in http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0 -- it will work just fine (well, works fine for me and thousands of other PhpStorm users -- does not matter what framework is used -- at all).
All POST/GET/etc variables are available in Variables tab (see http://www.jetbrains.com/phpstorm/webhelp/monitoring-the-debug-information.html ) of the debugger panel. Alternatively, you can use Watches tab to watch for any specific array index or variable.
Hi Andriy- Fantastic ! It works with CI ! .. I got it wrong when the user guide says to reload the page after starting the the listener and the debugger - your instructions where much better.
I have been doing all my PHP/ CI / HTML/CSS work on Dreamweaver and have recently got fed up with the lack of debugger and using endless print_r and echo statements. So now it is time to use a real IDE - Storm is Fantastic ... I have tried Netbeans, Zend Studio and Aptana. Storm is the only IDE other than Dreamweaver which allows you to work with HTML as well as PHP.
Now that it is working I need to learn how to use a debugger in an intelligent & creative way - any recommendations for tutorials / materials are very welcome.
Many Many Thanks !
Vince