smyle Posted July 2, 2008 Share Posted July 2, 2008 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 Link to comment https://forums.phpfreaks.com/topic/112942-php-newb-in-need-of-assistance-on-outsourced-script/ Share on other sites More sharing options...
trq Posted July 2, 2008 Share Posted July 2, 2008 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'; } Link to comment https://forums.phpfreaks.com/topic/112942-php-newb-in-need-of-assistance-on-outsourced-script/#findComment-580198 Share on other sites More sharing options...
smyle Posted July 2, 2008 Author Share Posted July 2, 2008 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.. Link to comment https://forums.phpfreaks.com/topic/112942-php-newb-in-need-of-assistance-on-outsourced-script/#findComment-580310 Share on other sites More sharing options...
revraz Posted July 2, 2008 Share Posted July 2, 2008 Remove the leading "/" Link to comment https://forums.phpfreaks.com/topic/112942-php-newb-in-need-of-assistance-on-outsourced-script/#findComment-580360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.