I have a php script that reads a csv file that contains URLs, follows the URLs, parses them and save some data into a database. The csv is around 1000 lines. However, my php script seems to stop after parsing some URLs (between 2 and 15 - never less, never more, but always different) neither showing any error in the browser nor writing it to php_errors.php.
I have also placed enabled php server logging via .htaccess:
# enable PHP error logging
php_flag log_errors on
php_value error_log "home/user/public_html/path/php_errors.log"
Also did I set the logging parameters in the php script with:
error_reporting(E_ALL);
ini_set('display_errors', 1);
I have no idea how to catch the reason why the script breaks. It really works perfect until it stops.
Before adding this question I run into another question on stackoverflow and addressed all the resolutions.
I set display_errors = on in php.ini.
My script has no syntax errors and it parses well to a point.
Try this:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
How do I get PHP errors to display?
you can also check the /var/log/apache/ folder and try to locate error.log - it should contain error message independent of error show settings
Related
I have an Apache2 web server with PHP 5.5 installed.
My default PHP settings is display_error = 0 (I don't need globally displayed errors) but I need it on in specific PHP files.
I tried with:
error_reporting(E_ALL);
ini_set("display_errors", 1);
and it's not working.
Can someone tell me how can I make it show errors in specific PHP files?
i am try to force some error writing some no syntax logic and not showing error...
To show parse errors in PHP you have to put this on your php.ini
display_errors = on
My advice is to avoid displaying errors on production servers but log them all. So you can later inspect and fix bugs from yoursite-error.log file.
You should be concerned if your applications has warnings, errors etc. IMHO it is a bad idea to focus your attention only on few files instead of them all.
Although display_errors may be set at runtime (with ini_set()), it won't have any effect if the script has fatal errors. This is because the desired runtime action does not get executed.
I am on OpenSUSE, I've installed PHP, when I test a simple PHP code, it works, but once I'm trying to display a PHP code that has errors, I get the following error :
The localhost page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
I have changed the value of display_errors to on in the php.ini file, I have also tried all solutions I could find but I still do get that message instead of the actual errors in my PHP file.
I have also added the following lines on the beginning of my PHP file but it didn't solve the problem :
ini_set('display_errors', 1);
error_reporting(~0);
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
I am getting internal server error when calling php script via ajax. I set ini_set("display_errors", 1); error_reporting(E_ALL); but still no details .. what else should I do
inside your php.ini the
display_errors = On
The php.ini file is where base settings for all php on your server, however these can easilybe overridden and alterd any place in the PHP code and affect everything following that change. This happens a in frameworks. A good check is to add the display_errors to you php.ini. If you don't see an error, but one is being logged, insert this at the top of the file causing the error:
ini_set('display_errors', 1);
error_reporting(E_ALL);
If this works then something earlier in your code is disabling error display.
Im lost here, closed few files and clicked yes on save all and now page wont load and error_reporting(1); its in all documents... No erors given
If your error isn't a syntax error, you can manually debug by placing die('test'); in various areas of your code to see if that portion executes.
You also need to turn on the display of errors, so at the top of your file add:
error_reporting(E_ALL);
ini_set("display_errors", 1);
Turn on error_reporting and display_errors in your php.ini file. If you have a syntax errror in the script, most likely the script's being killed long before execution could ever reach in the in-script ini_set/error_reporting overrides.
You might want to check the server's error log, as fatal errors generally get sent there if error reporting/display is turned off.