tanveer Posted May 28, 2011 Share Posted May 28, 2011 Hi, After a long time I start php again to do some stuff and using OOP concept for the first time and getting this below error PHP Fatal error: Class 'SystemConfig' not found in /home/tanveer/Workspace/EmailTest/webapp/classes/MailParser.class.php on line 12, referer: http://localhost/EmailTest/public_html/index.php My project directory structure is as follows: \webapp: |- classes |- MailParser.class.php |-DatabaseConnect.class.php |-SystemConfig.class.php \public_html: |-header.php |-footer.php |-gencsv.php |-stat.php \css |-style.css \images index.php And the php code file that I am trying to make work is as follows: class MailParser extends SystemConfig { /* Reads the files passed line-by-line * @param $fileName */ public function readFiles($fileName){ $fileHandler = fopen($fileName,'r'); while ($line = fgets($fileHandler)) { echo $line."<br />"; } fclose($fileHandler); } /* Traverse the user specified directory * @param $dirPath */ public function traverseDirectory($dirPath) { echo $dirPath; $sentFolderPath = new SystemConfig(); $sentFolderPath->getSentMailFolder(); $totalDirPath = $dirPath."/".$sentFolderPath; echo $totalDirPath; $io=0; if ($handle = @opendir($dirPath)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $newdir = ""; $filetext = ""; if (!is_file($dirPath."/".$file) or is_dir($dirPath) ) { $io++; $newdir.= $dirPath."/".$file."/"; print $newdir."<br />"; $this->traverseDirectory($newdir); if(is_file($dirPath.$file)) { $text = str_replace('//','/',"".$dirPath.$file."\n"); } } } } closedir($handle); } } } $rmf = new MailParser(); $rmf->traverseDirectory($_POST["dirpath"]); ?> Quote Link to comment https://forums.phpfreaks.com/topic/237698-getting-error-in-inheritance-of-class/ Share on other sites More sharing options...
noXstyle Posted May 28, 2011 Share Posted May 28, 2011 Have you included the actual class? If you're not using any autoloaders you must include the class manually. Quote Link to comment https://forums.phpfreaks.com/topic/237698-getting-error-in-inheritance-of-class/#findComment-1221497 Share on other sites More sharing options...
tanveer Posted May 28, 2011 Author Share Posted May 28, 2011 thanks .. I missed that one right.. Quote Link to comment https://forums.phpfreaks.com/topic/237698-getting-error-in-inheritance-of-class/#findComment-1221500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.