What are common reasons for encountering a white screen when running PHP code?

Encountering a white screen when running PHP code is often caused by a fatal error that is not being displayed. This can be due to syntax errors, memory limits, or issues with the server configuration. To solve this issue, you can enable error reporting in your PHP code to see the specific error message causing the white screen.

error_reporting(E_ALL);
ini_set('display_errors', 1);