Webmaster Forum

Webmaster Forum (http://www.v7n.com/forums/index.php)
-   Coding Forum (http://www.v7n.com/forums/forumdisplay.php?f=16)
-   -   How to enable php display_errors? (http://www.v7n.com/forums/showthread.php?t=422054)

seodaikaads 10-31-2017 03:57 AM

How to enable php display_errors?
 
I cannot enable the display_errors setting in PHP. What could be the reason?

I'm using virtual box with PHP 5.3 installed with apache2 running. I have tried everything to get display errors but nothing seems to work.

I have set php_flag display_errors on in my htaccess file and enabled it directly in the php.ini file

I tried the below two format
1. Code: display_errors = 1
2. Code:display_errors = On

ScriptMan 10-31-2017 04:25 AM

I think my ini file is 5.4 but the two should be about the same.

PHP Code:

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.

allow_call_time_pass_reference
;   Default ValueOn
;   Development ValueOff
;   Production ValueOff

display_errors
;   Default ValueOn
;   Development ValueOn
;   Production ValueOff

display_startup_errors
;   Default ValueOff
;   Development ValueOn
;   Production ValueOff

error_reporting
;   Default ValueE_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development ValueE_ALL
;   Production ValueE_ALL & ~E_DEPRECATED & ~E_STRICT 

and further down in the ini file:

PHP Code:

Error Level Constants:
E_ALL             All errors and warnings (includes E_STRICT as of PHP 6.0.0)
E_ERROR           fatal run-time errors
E_RECOVERABLE_ERROR  almost fatal run-time errors
E_WARNING         run-time warnings (non-fatal errors)
E_PARSE           compile-time parse errors
E_NOTICE          run-time notices (these are warnings which often result
;                     from a bug in your codebut it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it'
s automatically initialized to an
;                     empty string)
E_STRICT          run-time noticesenable to have PHP suggest changes
;                     to your code which will ensure the best interoperability
;                     and forward compatibility of your code
E_CORE_ERROR      fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP'
s
;                     initial startup
E_COMPILE_ERROR   fatal compile-time errors
E_COMPILE_WARNING compile-time warnings (non-fatal errors)
E_USER_ERROR      user-generated error message
E_USER_WARNING    user-generated warning message
E_USER_NOTICE     user-generated notice message
E_DEPRECATED      warn about code that will not work in future versions
;                     of PHP
E_USER_DEPRECATED user-generated deprecation warnings
;
Common Values:
;   
E_ALL (Show all errorswarnings and notices including coding standards.)
;   
E_ALL & ~E_NOTICE  (Show all errorsexcept for notices)
;   
E_ALL & ~E_NOTICE & ~E_STRICT  (Show all errorsexcept for notices and coding standards warnings.)
;   
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
; Default 
ValueE_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
Development ValueE_ALL
Production ValueE_ALL & ~E_DEPRECATED & ~E_STRICT
http://php.net/error-reporting
;error_reporting E_ALL E_STRICT remarked 2-1-13
error_reporting 
E_ERROR E_RECOVERABLE_ERROR 


Even if error reporting is correctly set on there are routines that might be added to scripts that suppresses them. This page provides some information about that: https://stackoverflow.com/questions/...errors-php-5-3

J. H. Rasmussen 10-31-2017 11:17 AM

Adding this PHP-code to the beginning of a PHP-script will display errors for that file(if the warning/error occur after those two lines has been processed by PHP):
Quote:

error_reporting(E_ALL);
ini_set('display_errors', 1);
Also remember if you make changes to the php.ini-file then you may need to restart the server for the changes to take affect.

AndriusDono 12-17-2017 05:06 AM

To make things even more clear, you should restart apache/nginx (or other web server), but not your whole server (reboot command).

aesthetiqclinic 02-19-2018 10:08 PM

You should go to php.ini file in the server that if you have local server to uncomment that error displaying to see the errors.


All times are GMT -7. The time now is 12:06 AM.

3.8.7