bryantms Posted January 3, 2008 Share Posted January 3, 2008 I'm having trouble getting the Auth package to work. I'm trying to set it up, but I get this error: Fatal error: Class 'Auth' not found in /home/fearandf/php/Auth/HTTP.php on line 54 I've tried searching for quite a while now, but have found nothing to solve this. The login.php file I'm trying to create is here: <?php // Example of Auth_HTTP the also returns additional information about the user require_once('config.php'); require_once('db_login.php'); require_once('/home/fearandf/php/Auth/HTTP.php'); // We use the same connection string as the pear DB functions $AuthOptions = array( 'dsn'=>"mysql://$db_username:$db_password@$db_host/$db_database", 'table'=>"users", // your table name 'usernamecol'=>"username", // the table username column 'passwordcol'=>"password", // the table password column 'cryptType'=>"md5", // password encryption type in your db 'db_fields'=>"*" // enabling fetch for other db columns ); $authenticate = new Auth_HTTP("MDB2", $AuthOptions); // set the realm name $authenticate->setRealm('Member Area'); // authentication failed error message $authenticate->setCancelText('<h2>Access Denied</h2>'); // request authentication $authenticate->start( ); // compare username and password to stored values if ($authenticate->getAuth( )) { session_start( ); $smarty->assign('blog_title',$blog_title); $smarty->display('header.tpl'); //setup session variable $_SESSION['username'] = $authenticate->username; $_SESSION['first_name'] = $authenticate->getAuthData('first_name'); $_SESSION['last_name'] = $authenticate->getAuthData('last_name'); $_SESSION['user_id'] = $authenticate->getAuthData('user_id'); echo "Login successful. Great to see you "; echo $authenticate->getAuthData('first_name'); echo " "; echo $authenticate->getAuthData('last_name').".<br />"; $smarty->display('footer.tpl'); } ?> Couple things to make it clearer what I'm doing: Using MDB2 Using Smarty Template Engine Trying to create a very basic page using Auth Using Auth_HTTP extension right now, but don't really want to Has anyone had any experience with Auth to be able to help me out? Quote Link to comment Share on other sites More sharing options...
teng84 Posted January 3, 2008 Share Posted January 3, 2008 this file has the error HTTP.php it is calling the AUTH class that is not found Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 I edited HTTP.php a bit earlier to get it to find a .php file it was missing. But that line is as follows: class Auth_HTTP extends Auth { And then there are a bunch of variables being set. The problem is that I don't know how to fix this error. Quote Link to comment Share on other sites More sharing options...
teng84 Posted January 3, 2008 Share Posted January 3, 2008 you have to include that file have auth class because you are extending it so it should also be included.. Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 I think what you were saying is that Auth.php needs to be included as well as it is being extended: require_once('/relative/path/to/Auth.php'); But I've tried that in all its forms and I'm still getting the same error: Fatal error: Class 'Auth' not found in /home/fearandf/php/Auth/HTTP.php on line 54 Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 3, 2008 Share Posted January 3, 2008 try installing your Auth class through pear.... if possible, change the include path you cannot keep changing the Auth class all the time... Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 I've just installed it using PEAR installer (pear install Auth & pear install Auth_HTTP) and I'm getting the same error message. I need to edit line 24 to direct it to the correct Auth.php file but then it still says it can't find Class Auth. I'm starting to think this is something to do with the setup. Might this be server related since it's a shared host and many of the file paths are all relative to a folder within the root? Does that throw off many of PEAR's packages? I'm guessing at this point... Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 3, 2008 Share Posted January 3, 2008 do you also have the Auth directory in scripts folder if so rename or remove that directory... Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 I only installed the Auth directory using PEAR's installer. It isn't anywhere else. I've been trying to find some information online about Auth and installing it but there just isn't much at all. There's gotta be something we're missing... Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 3, 2008 Share Posted January 3, 2008 Ok can you check phpinfo and see that the pear directory is in your include path ? Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 .:/usr/lib/php:/usr/local/lib/php Is the include path - how can I check if that is where Pear directory is? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 3, 2008 Share Posted January 3, 2008 hmmm.. i don't think the pear directory is included.. you could include it with ini_set.. in your script but you'll have to find out where the package got installed Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 After browsing around for a couple of hours, I think I finally figured it out. You were right...the pear directory was not included in PHP. I just included this little baby: ini_set('include_path', "/home/fearandf/php"); For which the relative path is the location that pear is installed. Now I just need to figure out how to add the to my .ini file (of which I just found) so that this code doesn't need to be placed on every page using Pear (all of 'em). Any hints on what to put in the ini file and where? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 3, 2008 Share Posted January 3, 2008 you'll find something like an uncommented "include_path" directive include_path=".;..." just put a semi-colin at the end before the quotes and add your path there include_path=".;...;/home/fearandf/php" something like the above and it should work Quote Link to comment Share on other sites More sharing options...
bryantms Posted January 3, 2008 Author Share Posted January 3, 2008 Thanks a lot for all your help! Quote Link to comment 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.