Despite having installed XAMPP 1.7.4 with PHP 5.3.5, users encounter an issue where PHP fails to display error messages. For instance, attempting to connect to MySQL using mysql_connect() without providing the necessary parameters doesn't trigger any error reports from PHP.
原因:
This behavior occurs because PHP's default error reporting settings are configured to suppress most non-fatal errors.
解决方案:
To enable error display, there are two approaches:
Script-Level Configuration:
At the beginning of the PHP script, add the following lines:
ini_set('display_errors', 1); error_reporting(~0);
This configuration turns on error reporting and sets the error level to the maximum value.
php.ini Configuration:
For non-production development or testing environments, error reporting can be enabled directly in the php.ini file. Search for the following settings and modify them as needed:
error_reporting = E_ALL ;error_reporting = E_ERROR display_errors = On ;display_errors = Off
The above is the detailed content of Why Aren't My PHP Error Messages Displaying in XAMPP?. For more information, please follow other related articles on the PHP Chinese website!