Log in

View Full Version : php returning blank screen & I cant find error



jabbyjim
07-19-2011, 06:19 PM
I really believe I have gone through all the steps, but my php is returning no errors, or any out put at all.:confused: I'm trying to do the following exercise:

http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

what I noticed was that it wasn't working, so I decided to go directly to my .php file and got absolutely no output at all. Pretty frustrating

(see for yourself)
http://www.oldpcgaming.com/test/pics/getalbumpics.php

I try the same script located on dynamic's sample and I get expected results
http://www.dynamicdrive.com/dynamicindex4/phpgallery/getalbumpics.php

so I configured php.ini on my server to show error logs, and I see nothing, now what? the error log isn't populating with anything, and I even tried a error_reporting(E_ALL) command but I barely understand how to use it.

I made a info.php in the same directory to test to see if php was working at all (and it appears that it is)

http://www.oldpcgaming.com/test/pics/info.php

I am at a complete loss, any help from the php experts?


<?php
error_reporting(E_ALL);
?>

<?
Header("content-type: application/x-javascript");

function returnimages($dirname=".") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo " [$curimage, \"$file\", \"$filedate\"],\n";
$curimage++;
}
}
echo " [\"placeholder\"]\n";
closedir($handle);
}
return($files);
}

$photovar=$_GET['id'];
if (!eregi("^[a-zA-Z0-9_]+$", $photovar)){
echo "alert(\"Photo Album ID must contain only letters, numbers, or underscore, and cannot start with a number\")";
die();
}
echo "var $photovar={\n";
echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
echo " images: [\n";
returnimages();
echo " ],\n";
echo " desc: []\n";
echo "}\n";
?>

jabbyjim
07-19-2011, 06:30 PM
omg I'm stupid...

<?php


sorry gents!

djr33
07-19-2011, 09:24 PM
For future reference, PHP only returns errors if it understands enough of the code to respond to it. When there is a parse error for the page as a whole such as a missing parenthesis or missing <?php or ?>, you may receive no response at all because PHP does not even know where to begin. If this happens, debug for major typos like that, and usually it will fix it.
(Or, for others facing a similar problem, you might need to turn on error reporting.)

griffinwebnet
07-20-2011, 05:20 PM
quick note, to avoid future confusion, note that show error logs and show errors in php.ini are 2 totally different things, make sure you enable the correct one, because it annoying when you cant figure out why no errors are displaying only to realize you enabled the wrong thing. lol... can you tell ive been down that road? :P