CodeIgniter Forums
No feedback on error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: No feedback on error (/showthread.php?tid=17358)

Pages: 1 2


No feedback on error - El Forum - 04-02-2009

[eluser]koryrok[/eluser]
Hi all,

Codeigniter newbie here.. I sometimes have errors in my code and sometimes I can see the error onscreen (in the browser) and other times I see absolutely nothing which makes it very difficult to debug.

Is there a way to turn on a debugging mode in CI so as to view what caused the error?

Thanks,
Kory


No feedback on error - El Forum - 04-02-2009

[eluser]Thorpe Obazee[/eluser]
I don't think there is a CI way to do this but you can always turn on the profiler and see if you're doing something right with queries, etc.


No feedback on error - El Forum - 04-03-2009

[eluser]TheFuzzy0ne[/eluser]
Usually when you can't see an error, it's caused by the browser not rendering it properly. The best way to spot errors like this is to develop your apps using FIrefox with the Tidy plugin. If your page is valid, the error will either display on the page, or your page will show as being invalid.

Also, if you've set your log_threshold to 1 or higher, you should see these errors in your log. If you have SSH access, you can use:

tail -f <name_of_log_file>.php

and that will show you any changes to the file in real time.

You can do this instead, which will (in theory), only show lines with errors.

tail -f <name_of_log_file>.php | grep "Severity:"


No feedback on error - El Forum - 04-03-2009

[eluser]koryrok[/eluser]
Im on a windows box and dont have SSH atm. Can't I just use some sort of standard error template? With Coldfusion, regardless of the error, it will always display on screen (what caused it at what line). It seems PHP/CI only does this 30% of the time so 70% of the time I have no way to quickly figure out what the problem is because even If I view source its completely empty.


No feedback on error - El Forum - 04-03-2009

[eluser]TheFuzzy0ne[/eluser]
Sure. ./system/application/errors/ contains the templates for you to edit. You might be able to fix the problem.

I think it would be great if errors could be displayed through the profiler.


No feedback on error - El Forum - 04-03-2009

[eluser]koryrok[/eluser]
This isn't making sense. Why wont PHP/CI stop trying to display my page/my template and just show the error template and error by themselves? Does this make sense what Im asking?


No feedback on error - El Forum - 04-03-2009

[eluser]koryrok[/eluser]
Consider the following example:

Controller:

Code:
&lt;?php

class Test extends Controller {

    function Test()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $data['title'] = 'Some data';
        $this->load->view('errortest', $data);
    }
    
?&gt;

View:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Error Test&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
test
&lt;/body&gt;
&lt;/html&gt;

So, Im expecting to see the word "test" when I hit this page, instead, I see absolutely nothing at all.


No feedback on error - El Forum - 04-03-2009

[eluser]TheFuzzy0ne[/eluser]
Are you trying to say that you are not getting any output at all?


No feedback on error - El Forum - 04-03-2009

[eluser]koryrok[/eluser]
Yup, nothing at all.


No feedback on error - El Forum - 04-03-2009

[eluser]jedd[/eluser]
What is the name of your view file, and where is it located?

Insert some echo statements into your controller - do you see those returning data to the screen?