Jump to content

PHP Newb in need of assistance on outsourced script


smyle

Recommended Posts

So my level of expertise is near nil.. I know enough to get me into trouble.

 

I got a script which is not working, throwing up error messages of :

 

Warning: require_once(includes/classes/DB.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/contentb/public_html/includes/mainheader.php on line 15

 

Fatal error: require_once() [function.require]: Failed opening required 'includes/classes/DB.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/contentb/public_html/includes/mainheader.php on line 15

 

I believe I have tracked the problem down to the following line

 

function __autoload($class_name) {
require_once CLASS_PATH . $class_name . '.class.php';
}

 

Searching for an answer prior to posting I found that normally these messages are returned because the file isnt present etc..  but I did verify that  DB.class.php is located within the directory of:

 

public_html/includes/classes/

 

Any assistance, guidance, or what not provided in this matter is truly appreciated.

Thanks

You either need to find where the CLASS_PATH constant is defined (recomended), it will look like...

 

<?php define("CLASS_PATH","/path/to/classes"); ?>

 

Or, simply change your __autoload() function to point to the existing path. eg;

 

function __autoload($class_name) {
  require_once "includes/classes/" . $class_name . '.class.php';
}

okay.. so I changed the coding to

 

function __autoload($class_name) {
require_once  "/home/contentb/public_html/includes/classes/" . $class_name . '.class.php';
}

 

 

and got the following errors...

 

Warning: include_once(includes/smarty/Smarty.class.php) [function.include-once]: failed to open stream: No such file or directory in /home/contentb/public_html/includes/mainheader.php on line 31

 

Warning: include_once() [function.include]: Failed opening 'includes/smarty/Smarty.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/contentb/public_html/includes/mainheader.php on line 31

 

Warning: require_once(/home/contentb/public_html/includes/classes/Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/contentb/public_html/includes/mainheader.php on line 15

 

Fatal error: require_once() [function.require]: Failed opening required '/home/contentb/public_html/includes/classes/Smarty.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/contentb/public_html/includes/mainheader.php on line 15

 

 

I am using Smarty in a section of this site and the paths seem to be valid, and files are present where they should be..    If anyone has any suggestions I am all ears...  If not.. I might wait until tomorrow when I have a clear head..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.