1
I have this script: and when I move it to the remote server a blank page appears, this is the only page on the site that gives this and I don’t understand why. On site everything is ok, no error and if I see the source code of the pag tb appears nothing. All blank
<?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>
The php version of both servers is the same?
– rray
Yes, this is the only page on the website where this happens... http://iwanttobesanta.com/picsUpload/ happens on the website of Andom images
– Miguel
The production server is the same operating system and file structure?
– Marcelo Aymone
Quite pertinent comment from @Marceloaymone. remember that in web PHP is almost always run in environment *Nix that is case-sensitive while the vast majority of PHP programmers, program on Windows that is not. Also, I have never seen pass -1 to error_reporting(). Use one of the described values in the manual
– Bruno Augusto
I think it’s a problem with the BD connection and the BD class has something like this: or die();
– Jader A. Wagner
Do you have access to PHP error logs on the remote server? There they are always saved, if the PHP guidelines change at runtime (ini_set()) are not enabled.
– NewtonWagner
Just to say that I was able to solve, without realizing why it seems that in the "Else if (!Empty($database->errors)) {..." part there was some kind of conflict, I only removed the "Else" and left the "if" and it worked
– Miguel
@Miguel Which version of php were you using? I think this one question explains the reason for the error. Could the test change the line
else if (!empty($database->errors())){
by:$erros = $database->errors();
 else if (!empty($erros)){
.– rray