• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Displaying PHP Errors - Blank Screen

#1
[eluser]moopa[/eluser]
Hi all.

I am new to Codeigniter and I think it is great.
The only issue I am having is with PHP errors not displaying.

As an example, If I create a method in my model "VideoDataSource" and forget to add a semicolon at the end of a line, I simply get a blank screen in the browser when I attempt to use the model in a controller.

If I get an error in the view the error displays fine.

Is there anyway I can rectify this?

Thanks in advance,

Moopa

#2
[eluser]jedd[/eluser]
[quote author="moopa" date="1259280505"]
Is there anyway I can rectify this?
[/quote]

Remember to add the semicolon.

#3
[eluser]jedd[/eluser]
Okay .. more helpfully .. there are some debugging tools you can install, FirePHP is one.

I'd have thought a missing semi-colon would be fairly obvious anywhere, and shouldn't be hidden when it happens in a model. Your browser's page-view-source is often handy (though it sounds like it might not be here).

See attached screen shot for what happens when I miss a semicolon on my model. For the life of me I can't remember what I installed or configured or upgraded, indeed whether it was server or client side, to give me these funky error messages. Bloody marvellous things, though. (If someone else knows, you're in for a treat.)

#4
[eluser]moopa[/eluser]
Thanks for the response.

I have contemplated installing FirePHP but more than anything, I was curious as to why even with E_ALL I get nothing. Is this a shortcoming of Codeigniter? Possibly MAMP?

The semicolon was a simple example, but after posting I had another issue in a complex view with a for each for a query row.

I located the typo eventually ($$row->title) but I am just a little thrown by the lack of error output to the screen.

Will install FirePHP when I get a bit of time shortly.

Cheers

#5
[eluser]jedd[/eluser]
[quote author="moopa" date="1259282078"]
I have contemplated installing FirePHP but more than anything, I was curious as to why even with E_ALL I get nothing. Is this a shortcoming of Codeigniter? Possibly MAMP?[/quote]

Unsure about MAMP - I'm a Debian GNU/Linux user .. so it's all plain sailing over here Smile

Very odd that E_ALL gets you nothing, still, though. Hopefully some other OSX users can pop up with some insights and suggestions.

Quote:I located the typo eventually ($$row->title) but I am just a little thrown by the lack of error output to the screen.

I don't use variable variables, but I think that's valid code.

#6
[eluser]cahva[/eluser]
Do you have display_errors set to on also? Check your phpinfo for that.

#7
[eluser]moopa[/eluser]
[quote author="cahva" date="1259285331"]Do you have display_errors set to on also? Check your phpinfo for that.[/quote]

That was the problem Wink
Been a while since I have used php and I guess my memory is not what it was!

For other folks using MAMP, the soloution to this problem is to:-

1. Open up the file /MAMP/conf/php5/php.ini
2. Search for display_errors
3. Change display_errors = Off to display_errors = On

Thanks very much for you help Smile

Moopa

#8
[eluser]kcmerrill[/eluser]
I realize this is an old thread but wanted to contribute for those that stumble upon here via google, because I was having the same problems as well. Changed in the index file error reporting level to this:

ini_set("display_errors",1);

It's working now. You'll want to change that while your in your production enviornment of course.

-kc

#9
[eluser]cheungj[/eluser]
Also realise this is an old thread but this would have saved me a lot of time if I found it earlier.

moopa explains the answer.
My way to implement this was to go to the index.php which is a sibling to the 'application' folder.

At the top of the file, I have set the instance to development:
Code:
define('ENVIRONMENT', 'development');

Then lower in the same file, use
Code:
ini_set("display_errors", 1);
to set error messages on:

Code:
case 'development': {
   error_reporting(E_ALL);
   ini_set("display_errors", 1);
   break;
  }


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.