Zend Framework doesn't show errors - php

Every error that happens in the server is not shown to me... I tried checking the requisitions in Firebug, but everytime when there is an error, the response fails.
Only "Internal Server Error 500" is displayed.
I think I am missing some concepts... can someone help me, please?
Thanks

You should keep in mind that in development environment you should turn on error display and set your error reporting level to E_ALL.
just write these two lines in your code or in your init() function
error_reporting(E_ALL);
ini_set('display_errors', true);

Related

Why doesn't PHP show all of the syntax errors?

This is my error setting
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL|E_PARSE);
Now I write this test code:
helloooooo;
And It shows me:
Use of undefined constant helloooooo ...
So far so good.
Now I remove the semicolon from end of my so-called code:
helloooooo
Shows nothing. It shows a white page.
In my experience whenever I see a white page there is a syntax error so I look for a typo.
The question is why doesn't PHP help in this case?
Someone said :
Syntax checking is done before executing any code. So it can't execute
the ini_set() functions if there's a syntax error.
How about PHP interpreter applies settings first then executes the rest of code?
JavaScript interpreter can detect the same error in runtime.
Just try this:
<script>
helloooooo
</script>
Now go to Firefox => Tools=> WebDeveloper => WebConsole
ReferenceError: helloooooo is not defined
PHP's default error reporting mechanism (might) suppress error output. If you're trying to turn it on at runtime using the error_reporting function, then PHP will first have to successfully parse the file, then execute it to set that new desired error reporting level. That fails when there are syntax errors, because then PHP can't successfully parse and execute the file to change the error reporting level. The syntax error is getting suppressed because… well… it couldn't change the error reporting level yet.
Javascript doesn't have that, it outputs any and all errors it encounters.
The reason PHP likes to suppress errors is because its running on the server, and internal server debug details shouldn't be shown on public web pages. In Javascript that is moot, since it's running in the browser anyway, and the errors are reported to the console, which regular users don't see. Moreover, PHP does log all errors to a log file, so the same way you go looking for errors in Javascript, you could explicitly go looking for them in PHP's log file as well.

Laravel displaying / logging errors

So I've just spent quite some time on something that should have been very quick to fix.
I'm on a local environment, with debug set to true. I was working on a php file which implements the Jsonable interface, and I got the compatibility a bit wrong. Unfortunatly, when I ran this file, it simply showed a 500 error and a completely blank, white page, without any errors.
I checked my error log, and that didn't have any errors in it (relating to this issue) either.
I found online that setting debug to true in Laravel hides sets display_errors to 0. I quickly did a ini_set('display_errors', 1) in my called controller and I got the fatal error message I was looking for!
My question is:
How can I display these fatal errors etc (not exceptions) in Laravel when debug is true, without specifying ini_set('display_errors', 1) in all my controllers?! Why does Laravel hide errors when in debug mode anyway?! It's very frustrating having an error which isn't displayed (even when in debug mode), and isn't logged!
Any help is appreciated.

php, ajax error reporting is not working

i have this file and on a click event it calls a php function through $.post{}
i have used alert(data) to recognized errors. But unfortunately its not allerting anything except it shows an error on firebug console with relevant url "Internal server error 500" and then i tried to access the code through browser pasting the full url, I have put error_reporting(E_ALL);
ini_set("display_errors", 1); , but shows a blank page. I'm lost here no idea how to solve this without any errors displaying.. Help much appreciated.
p.s in php info error reporting is off. i tried htaccess on my subfolder without no luck either.
Make sure of the following:
error_reporting(E_ALL) is right after <?php tag
There is indeed a PHP error - try to deliberately make one. Maybe the error is elsewhere, not your PHP but the .htaccess file (since you're getting 500), or maybe it's a logical error.

Having 500 Internal server error on any error on amazon hosting

I am working on amazon hosting using Kohana 3.x , PHP, and when there comes an error , it instead of showing error , it gives 500 internal server error. Due to which I have to debug my code on localhost but many times error come online only because many things can only be tested online then in that case I have to test it by commenting some part of code or line by line. So is there a way that instead of 500 internal server error it gives me actual PHP error or Kohana error that would be more helpful.
thanks in advance for your time guys.
I have experienced that in some cases my server will throw a 500 error (even with small stupid errors) if i dont apply these.
ini_set('display_errors', 1);
error_reporting(E_ALL);
Try applying these in the start of your code.
First of all never show PHP errors on a production website!
Implement your own HTTP error pages - http://kohanaframework.org/3.2/guide/kohana/tutorials/error-pages
Setup bootstrap.php for production:
Kohana::$environment = Kohana::PRODUCTION;
error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
Kohana comes up with built in error logging feature. Every HTTP error (404, 403, 500 etc) is automatically saved in application/logs/month/day.php file. Open this file and check what was the reason for error.
Are you using .htaccess file? It use to cause 500 internal server errors. Also check your server error logs

how to set apache error displayed on frontend?

when php scripts got error, the error usually goes to the apache error log (ubuntu setup).
how can i config the server so that the error will be directly output to the page, just like XAMPP is doing.
thanks in advance!
(the error i am referring to is php error. so that i can debug my php code easily)
display_errors = On
Put this line in your php.ini file.
If you just want to view the warnings and notices stick these two lines into the top of your php page
error_reporting(E_ALL);
ini_set('display_errors','1');
What kind of error?
Check the PHP docs on error handling http://de2.php.net/manual/en/book.errorfunc.php and setting your error reporting level http://de2.php.net/manual/en/function.error-reporting.php

Categories