PHP blank page in prod server but everything OK in place

1

I have this script: and when I moved it to the remote server a blank page appears, this is the only pag of the site that gives this and I do not understand why. In place is everything ok, does not give any error and if I see the source code of the page tb does not appear anything. All white

<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
require_once('conn.php');

spl_autoload_register(function($class) {
    require_once ('Classes/'.$class.'.php');
});

$database = new DB($db);

?>
<!DOCTYPE html>
<html>
    <head>
        <title>Pics Upload</title>
        <style>
        * {
            box-sizing:border-box;
            margin: 0;
        }
        div {
            font-size: 0;
        }
        #errors {
            color: red;
            font-size: 16px;
        }
        p {
            font-size: 13px;
            text-align: center;
            background-color: yellow;
        }
        .image {
            width: 33%;
            font-size: 0;
            display: inline-block;
        }
        .image img {
            width: 100%;
            border: 2px solid yellow;
        }
        </style>
</head>

<body>
<div id ="wrapper">
<h1>Display all images from Database</h1>
<br>
<a href="index.php">Home</a>
<br>
<a href="displayAll.php">Display all images from database</a>
<br>
<a href="mostVoted.php">Display the 3 most voted images</a>
<br>
<a href="imagesFolder.php">Display images from folder</a>
<form action="" method="POST">
    <label><br><br>Insert how many random images you want to see<br><input type="text" name="numRandom"></label><br>
    <input type="submit">
</form>
<?php
    setlocale(LC_ALL, 'pt_BR.utf8', 'Portuguese_Brazil');
    date_default_timezone_set('Europe/Lisbon');

    echo '<br><br>Total Rows (images) in Database: ' .$database->fetchRowCount(). '<br><br>';

    if (isset($_POST['numRandom'])) {
        $numOfRandom = $_POST['numRandom'];
        if ($database->inputRandomCheck($numOfRandom)) {
            $results = $database->selectRandomImage($numOfRandom);

            echo 'Total random images to display: ' .$numOfRandom. '<br><br>';
            echo '<pre>', print_r($results), '</pre>';

            $uppercaseDay = ucfirst(gmstrftime('%A'));

            ?>
            <div id="imgWrapper">
            <?php
            for ($i=0; $i<count($results); $i++) {
                ?>
                <div class="image">
                    <p><?php echo $results[$i]->image_name;
                        echo '<br>' .strftime($uppercaseDay.', %d/%b/%Y - %H:%M:%S', $results[$i]->uploaded); ?>
                    </p>
                    <p>Total votes = <?php echo $results[$i]->vote; ?></p>
                    <a href="<?php echo $results[$i]->link; ?>" target="_blank">
                    <img src="<?php echo $results[$i]->image_path; ?>"></a>
                </div>
            </div>
            <?php }
        }

        else if (!empty($database->errors())){
            foreach ($database->errors() as $error) {
                echo '<div id="errors">' .$error. '</div>';
            }
        }
    }

    else {
        echo 'Total random images to display:<br><br><br>';
    }
?>
</div>
</body>
</html>
    
asked by anonymous 31.07.2014 / 18:36

1 answer

1

The problem may be in this line:

require_once('conn.php');

Or this:

require_once ('Classes/'.$class.'.php');

You are calling up another file (s). What does he / she do?

Something that helps to know where the problem is is to put echo with something to start before and after the line where you suspect an error. For example:

require_once('conn.php');
echo 'Teste';

If you print, the error is not there.

Another problem may be related to file encoding. If it is encoded with UTF-8, make sure the "Include Unicode Signature (BOM)" option is not checked. If it is, this can cause problems when using commands such as header , session_start () , etc ... for which there can not be any type of printing before them and the BOM is a mark printed on the generated html).

If after these checks the error is not found, please post the complete content (conn.php file) to help you.

    
05.08.2014 / 19:21