Look in the log.
Be aware that by default error log is disabled when a space is in production mode.
The reason for this default behavior is to avoid unnecessary resource usage caused by sustained error logging.
Set log_errors to On in Space -> Services -> PHP and errors will begin to emerge in Space -> Log.
Setting web applications in maintenance mode might cause a 5xx error. Remember to disable maintenance mode again.