Hello please help me troubleshooting the problem below. I got the 500 Internal Server Error in My WP Site>Dashboard>Appearance>Custom.. Pleaaaaase. Below is the error shows when i check the document on Cpanel>File Manager>home3/faithcr4/public_html/error_log...

[07-Aug-2021 07:15:40 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home3/faithcr4/public_html/wp-content/maintenance.php:1) in /home3/faithcr4/public_html/wp-content/maintenance.php on line 3
    [07-Aug-2021 07:15:40 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home3/faithcr4/public_html/wp-content/maintenance.php:1) in /home3/faithcr4/public_html/wp-content/maintenance.php on line 4
    [07-Aug-2021 07:15:40 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home3/faithcr4/public_html/wp-content/maintenance.php:1) in /home3/faithcr4/public_html/wp-content/maintenance.php on line 5

Here is my code in /home3/faithcr4/public_html/wp-content/maintenance.php, I don’t have a deep understanding of coding, so I don’t understand what went wrong in it. I beg the programmers for help. Please tell me what's going wrong and how can I solve the problem. Thanks!

            <?php ob_start();
                header('HTTP/1.1 503 Service Temporarily Unavailable');
                header('Status: 503 Service Temporarily Unavailable');
                header('Retry-After: 3600'); // 1 hour = 3600 seconds
            ?>
            <!DOCTYPE html>
            <html lang="en-US">
                <head>
                    <meta charset="UTF-8" name="viewport" content="width=device-width", intial-scale="1.0">
                    <link rel="stylesheet" type="text/css" href="https://bluehost-cdn.com/media/user/bluerock/_bh/main.css">
                    <link rel="stylesheet" type="text/css" href="https://bluehost-cdn.com/media/user/bluerock/_bh/wp_dropins.css">
                    <title>Maintenance</title>
                </head>
                <body class="wp-dropin maintenance">
                    <main class="message">
                        <figure class="message__image"></figure>
                        <section class="message__block">
                            <h1 class="message__title">Maintenance Underway</h1>
                            <p class="message__text">This site is having some routine server maintenance. It should take less than a minute. </p>
                        </section>
                    </main>
                    <footer class="resolution">
                        <p>If this is your website and you see this page for more than a few minutes, please <a href="https://my.bluehost.com/hosting/help">contact support</a>. </p>
                    </footer>
                </body>
           </html>

Thanks..!

This error happens when you spit out PHP headers after any HTML code or white space.

Is this the entire file? No additional php includes or anything else at all?

Is there a blank line or spaces before the <?php at the top of the file?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.