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

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.