Why isn't error reporting working on drupal(6)? - php

In my settings.php file (located in /sites/default/), I have:
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 'stdout');
However, they are not showing on the screen.
For example, I had a problem where I was missing $ when referencing a variable and it would've been nice to have this displayed.
This has to be in the settings.php file because I have a test site and a live site and only the test site should display the PHP errors, so putting this in a php.ini file at the server level is not an option)

Go to Error reporting page (/admin/settings/error-reporting) and check that error reporting parameter. Is it set just to log errors or to log and display on screen?
If that doesn't help then run phpinfo() (http://php.net/manual/en/function.phpinfo.php) function and see is error display allowed. If it's not check the location of used php.ini file (again be looking at phpinfo() output), edit it to allow error displaying (restart web server) and error should appear.

Related

Not displaying errors in php

I am debugging some errors in my PHP bus booking site. My issue is that I am not able to display errors. When I googled this issue it shows you can achieve it though php.ini. But unfortunately I haven't find any php.ini file .
Now the error is showing as
This page isn’t working
cableandmedia.com is currently unable to handle this request. HTTP
ERROR 500
On your all-pages/or-a-common-file which-is-included-in-each-file.
On top just after starting <?php add these two lines:-
error_reporting(E_ALL);
ini_set('display_errors',1);
If you have php.ini file then check these two variables:-
display_errors
error_reporting
Now change these variables values to:-
display_errors=ON
error_reporting=E_ALL
Now save the file and restart your server(important if you are working on localhost).And you have good to go.
Add this line to your php file. To debug
ini_set('display_errors', 1);
error_reporting(E_ALL);

What could this error be?

I have upgraded PHP from 5.4 to 5.6 on one of our local servers, and now I have a php file, which when I try to open from the browser, it only results in a blank white screen.
The error reporting in php.ini is set to on, and I've also told at the beginning of the file to report all errors, yet the output is still blank. When I checked the error_log, it is empty. If I delete the whole content of the .php file, and replace it with a simple echo, everything works perfectly.
How could I debug this error?
Problem : Your error_reporting function may be off in your php.ini file.
Solution :
Sometimes by default in php.ini the display error function is off or allowed to show limited errors.
DISPLAY ERROR'S IN YOUR PHP FILE :
So to enable displaying errors in your php file,You will need to add one of the following statements at the begining of your php file just right after your <?php starting tag.
Note : By using any one of these statements,your php file will show every possible error.!
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
Reference Links :
http://php.net/manual/en/errorfunc.configuration.php#ini.display-errors
http://php.net/manual/en/errorfunc.configuration.php#ini.display-startup-errors
http://php.net/manual/en/function.error-reporting.php
#Credit Goes To #brslv

when i hit index page instead of error messages I'm just getting a blank page.PHP

when i hit index page instead of error messages I'm just getting a blank page. Is there any way to show PHP error messages instead? It's very hard to debug when I get no feedback. My environment is linux. PHP
there are more than one way to show errors in php scripts in linux..
first, in your index.php file, insert this codes:
error_reporting(E_ALL);
ini_set('display_errors', 1);
this enables displaying errors and warning from your browser..
or second, open php.ini file located at /etc/php5/apache2/php.ini and edit the line
display_errors = Off
to
display_errors = On
and restart apache2
sudo /etc/init.d/apache2 restart
NOTE: the first method only enables error message on the current file while the second method globally enables error messages to all php scripts..
sources:
display error message, show errors and warnings
You have your answer in this post
Basically you have to add this 2 lines at the beginning of the file
error_reporting(-1);
ini_set('display_errors', 'On');

MAMP pro PHP Error handling grief

So mamp pro is all set up using PHP 5.3.6 / cache is XCache, error handling set to Display Startup errors - write to All errors and warnings - to set to Display and Log both checked.
restart the server, intentionally wrote some code that should bring up an error..
<?php
echo stupid;
?>
Yes this is all thats in the code.
I get nothing! No errors, only in the log.
I don't want to have my console open the entire time watching for errors, I want them printed on the screen.
The only way I can get this to work is by doing an INCLUDE on this code at the top of EVERY SINGLE PHP file.
error_reporting(E_ALL);
init-- yad yada ('display_errors', 'on');
From what I'm reading elsewhere, it seems like this is a big problem..
So how can I set up my mamp pro PHP.INI file to work properly and print directly to my browser?
I changed it in MAMP/bin/php/php5.3.6/conf/php.ini
You can change display_errors and display_startup_errors

Enable errors in browser when parsing PHP-files

I recently changed to a MacBook and now use the MAMP-stack for development locally.
In my earlier development environment I always could see informative error-reports when I tried to access a PHP file through a web-browser and an error occurred. With the default installation of MAMP it seems that this feature is disabled, whenever I hit an error I can't see the cause of it, I can't even see a single line informing me that an error occurred.
Not until I start to debug the code in a debugger I can see where the error occurred.
Any idea how error reporting can be turned on?
I tried:
error_reporting(E_ALL);
No effect at all though.
reporting level to E_ALL and display errors on Include the following code at the top of every php file on in an include or require such as your config.php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
Try ini_set('display_errors', 'on');
You'll also want to check a phpinfo(), to see if the ini_sets are doing anything.
Or change "display_errors = Off" to "display_errors = On" in /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
Navigate to MAMP settings (eg localhost:8889/MAMP)
Click PHP Tab
Find Log errors: setting
Tick to screen
Click Save

Categories