DrumDude Posted September 25, 2006 Share Posted September 25, 2006 Hi,I am totally new to PHP scripting but had to upgrade Apache and PHP because of security issues.I upgraded from Apache 1.3.x and PHP 4.2.3 to Apache 2.0.54 and PHP 5.0.5.I now get this error on my index.php page:Fatal error: Call to a member function read() on a non-object on line 89.Here is the code I will insert#89 so you know which line 89 is.><?php $fileHandle = fopen("dlconfig2.txt", "r"); while (!feof($fileHandle)) { $aLine = fgets($fileHandle, 4096); parse_str($aLine); } fclose($fileHandle); for ($i = 0; $i < count($dropType); $i++) { $typeToPrefix[$dropType[$i]] = $dropPrefix[$i]; } $aDirectory = dir("");#89 while ($anEntry = $aDirectory->read()) { // Short cut because we know aDirectory only contains other directories. if ($anEntry != "." && $anEntry!="..") { $aDropDirectory = dir(""); $fileCount = 0; while ($aDropEntry = $aDropDirectory->read()) { if ((stristr($aDropEntry, ".html"))) { // Count the files in the directory $fileCount = $fileCount + 1; } } $aDropDirectory.closedir(); $parts = explode("-", $anEntry); if (count($parts) == 3) { $buckets[$parts[0]][] = $anEntry; $timePart = $parts[2]; $year = substr($timePart, 0, 4); $month = substr($timePart, 4, 2); $day = substr($timePart, 6, 2); $hour = substr($timePart,8,2); $minute = substr($timePart,10,2); $timeStamp = mktime($hour, $minute, 0, $month, $day, $year); $timeStamps[$anEntry] = date("D, j M Y H:i (O)", $timeStamp); if ($timeStamp > $latestTimeStamp[$parts[0]]) { $latestTimeStamp[$parts[0]] = $timeStamp; $latestFile[$parts[0]] = $anEntry; } } } } ?>Thanks for any help... Link to comment https://forums.phpfreaks.com/topic/21999-fatal-error-call-to-a-member-function-read-on-a-non-object-in/ Share on other sites More sharing options...
trq Posted September 25, 2006 Share Posted September 25, 2006 You dont open any directory here....[code=php:0]$aDirectory = dir("");[/code] Link to comment https://forums.phpfreaks.com/topic/21999-fatal-error-call-to-a-member-function-read-on-a-non-object-in/#findComment-98303 Share on other sites More sharing options...
DrumDude Posted September 26, 2006 Author Share Posted September 26, 2006 Thanks that was it.Keep on drumming ! Link to comment https://forums.phpfreaks.com/topic/21999-fatal-error-call-to-a-member-function-read-on-a-non-object-in/#findComment-99012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.