What server-side logs can be checked to diagnose a 500 error in PHP scripts?

A 500 error in PHP scripts typically indicates a server-side issue that is preventing the script from executing properly. To diagnose this error, you can check the server-side logs such as the Apache error log or PHP error log. These logs can provide more information on what is causing the error, such as syntax errors, permission issues, or server configuration problems.

// Example of checking the Apache error log for PHP errors
error_log("Checking Apache error log for PHP errors: " . ini_get('error_log'));