Hey i know there are a few posts regarding this topic and i have scoured them all!
I cannot not enable the display_errors setting in php no matter what i do!!!
Im using virtual box with php 5.3 installed with apache2 running. i have tried everything i can think of to get display errors working but nothing seems to work.
I have set php_flag display_errors on in my .htaccess file i have even enabled it directly in the php.ini file
display_errors = 1
and also tried
display_errors = On
I am using the defaults for apache sites-enabled is there something i need to do here to get this to work?? i have never had this problem running php on my mac using mamp.
Any suggestions would be greatly appreciated this is driving me nuts!
You can show Php error in your display via simple ways. Firstly, just put this below code in your php.ini file. ini_set ('display_errors', 1); ini_set ('display_startup_errors', 1); error_reporting (E_ALL); In Unix CLI, it's very practical to redirect only errors to a file:
The directive for showing PHP errors can also be enabled or disabled using the .htaccess file located in the root or public directory of the project. Similar to what will be added to the PHP code to show PHP errors, .htaccess also has directives for display_startup_errors and display_errors.
To use it, you need to act like this: So, you need to turn on the display_errors directive inside the PHP.ini file. It can display all the errors, particularly, parse and syntax errors that can’t be shown by calling only the ini_set function.
If adding some of the PHP code errors doesn’t show in the browser during testing, then the PHP ini configuration has some additional directives to handle this. The display_errors directive must be set to “on” in the PHP ini file.
You can also enable it in your PHP script usually:
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ALL);
If that doesn't help, then try a quick workaround first:
set_error_handler("var_dump");
Could be used to replicate the original behaviour, if it's suppressed by some other circumstance.
Take in mind, this only works for enabling runtime errors. If you suspect parse errors, you'll definitely have to enable error display in the php.ini / .htaccess / .user.ini. -- Else make a wrapper
test.php
script with above instructions, theninclude()
the faulty script.
Actually, in php.ini
there are two places where you can encounter display_errors
line. By mistake you can enable first one, but it is overriden by the last display_errors = Off
(such misleadming thing happened with me).
There is block that goes first in the file:
;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.
; display_errors
; Default Value: On
; Development Value: On
; Production Value: Off
And the last occurance of display_errors
much lower in the file:
; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
; Off = Do not display any errors
; stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
; On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = Off
Be sure to change last occurence of display_errors
. Just set it to display_errors = On
, restart Apache and you'll get what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With