I can't change the php.ini for some reason,
how can I do it in code level?
Try
ini_set — Sets the value of a configuration optionExample from Manual:
if (!ini_get('display_errors')) {
ini_set('display_errors', 1);
}
but keep in mind your hosting service might have disabled programmatic setting of ini settings.
Also keep in mind that you have to have error_reporting enabled:
error_reporting — Sets which PHP errors are reportedExample from Manual:
// Report all PHP errors
error_reporting(-1);
error_reporting(-1); enough ? Do I also set display_errors to on?Use ini_set (https://www.php.net/manual/en/function.ini-set.php)
Specifically,
ini_set('display_errors', 'E_ALL');
should work
Runtime configuration of error reporting can be finetuned with a number of functions, listed here: http://www.php.net/manual/en/errorfunc.configuration.php
But most directly related to your question, use error_reporting(E_ALL), and display_errors(1)
error_reporting(-1); //Passing in the value -1 will show every possible error, even when new levels and constants are added in future PHP versions
ini_set('display_errors', 'On');
Doc available there:
Another way (if your server supports it) is with an .htaccess file:
php_flag display_errors on
php_value error_reporting -1
-1 will show every possible error, even when new levels and constants are added in future PHP versions.error_reporting.
.htaccessis another option where available