If I run this program on Centos as "php file.php" it shows no output but php -l shows it has errors(; after EOT missing). How do I enable error reporting in this case?
<?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); $str = $_POST['name']; file_put_contents("out.txt",$str); print <<<EOT <html><body><h1>You've entered $str</h1></body></html> EOT
I've gone through: How can I get useful error messages in PHP?
To override display_errors=Off
in php.ini, add a -d
flag to the command line:
php -d display_errors=on script.php
Or just edit the ini and turn the flag on.
Try to set error_reporting to E_ALL instead of -1, this did the trick for me.
source: http://www.php.net/manual/en/function.error-reporting.php#85096
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