errors not being written to error log file

General discussions related to php

Moderators: macek, egami, gesf

ikan140
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Jan 07, 2013 10:42 am

errors not being written to error log file

Postby ikan140 » Mon Jan 07, 2013 2:04 pm

I have recently installed PHP5.5 as an Apache2.2 module on a WinXP SP3 box for local web development and future hosting. I am having a problem with a specific piece of code to be used as a template for generating a picture gallery on my site. (code in question below) A portion of the code appears to be faulty and is preventing the rest of the page from processing. I do know that both Apache and PHP are working correctly because several pages I have already created use PHP with no problems.
I would like to use the built in error logging in either PHP or Apache or both to help with debugging and since I am noob and still learning the code future debugging. My roadblock is that I can't get either of them to show me what is (or is not) happening.
I refered to the online PHP Manual for commands to force error logging and display and set my 'php.ini' to both log and display all errors and warnings. I have also referenced the Apache documentation for the same information and configuration settings.
However PHP is neither creating an error log in the specified folder (there is a note in the PHP Manuel specifically to not precreate the file because PHP will ignore a .txt with a size of 0MB) nor is it logging the error in the Apache error log. The Apache log is working correctly. It has been useful for tracing path errors with other pages and links. Thinking I was misunderstanding the manuasl I Googled the same procedures and settings and found several how to sites all with recomendations that matched the settings I already had. Working from the assumption that the problem lies in my lack of understanding please point me in either the right direction and or point out which of my settings are in error.

php.ini settings in question

error_reporting = E_ALL & E_STRICT

display_errors = "stdout"

display_errors = On

display_startup_errors = On

log_errors =On

log_errors_max_len = 1024 (default)

ignore_repeated_errors = Off (default)

ignore_repeated_source = Off (default)

report_memleaks = On (default)

;report_zend_debug = 0 (default)

track_errors = Off (default)

;xmlrpc_error_number = 0 (default)

html_errors = On

docref_root = "/phpmanual/" (default)
docref_ext = .html (default)

;error_prepend_string = "<font color=#ff0000>" (default)

;error_append_string = "</font>" (default)

error_log = /htdocs/error_log

; Log errors to syslog (Event Log on NT, not valid in Windows 95).
error_log = Off (default)


Just in case all the above are set correctly and the problem lies somewhere else here is the code in question supplied graciously by Devtek.org. Original code found here " http://www.devtek.org/tutorials/image_gallery.php " . Most of the commenting I put in to remind me what was supposed to be going on where and what didn't need to be there for the actual pages when they get published. Note the "ini_set" lines at the top which obviously I have wrong.(though am not sure why yet)


<?php
//ini_set(error_reporting(E_ALL,E_STRICT));
//ini_set(display_errors);

this part I use as a control to tell me if the page is even being found by the host
$today = date('h:i A T l F j, Y');
print "It is ".$today."<BR>";

$thumbs = "../illustrations/Origional_Photos_Here/a_bunch_of_cut_ups/TH_cu_set_1/"; # Location of thumbnails
$pics = "CU_set_1/"; # Location of big versions (subdir of $thumbs)
$cols = 4; # Number of columns to display
$pic_text = "CU_set_1/CU_names_1.txt"; # Located in TH_cu_set_1 direcory

this part apears to be the broken part, when commented out the rest of the page displays as expected
$fh=fopen("$pic_text", "r");
while(!feof($fh))
{
$temp = explode(",", $line);
$description[$temp[0]] = $temp[1];
$line=fgets($fh);
unset($temp);
}

broken ends here

if ($handle = opendir($thumbs)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != rtrim($pics,"/")) {
$files[] = $file;
}
}
closedir($handle);
}


$colCtr = 0;

echo '<table width="100%" cellspacing="3"><tr>';

foreach($files as $file)
{
if($colCtr %$cols == 0)
echo '</tr><tr><td colspan="' . $cols . '"><hr /></td></tr><tr>';
// this line and the echo below create a list of file names for easy referance and do not belong in the final code
$allfiles .= $file . ',<br />';
echo '<td align="center"><a href="' .$thumbs . $pics . $file . ' "><img src="' . $thumbs . $file . '" /></a><br />' . $description[$file][0] . '</td>';
$colCtr++;
}

echo '</table>' . "\r\n";
echo $allfiles;

?>

Thank you in advance for any help you can offer'

ikan140

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests