Jump to content

bryantms

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bryantms's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all - I'm working through the book Practical Web 2.0 Applications with PHP and have run into an issue. I am trying to install the main Controllers to handle the site. I have tried to implement an IndexController as follows: IndexController.php <?php class IndexController extends CustomControllerAction { public function indexAction() { } } ?> This extends CustomControllerAction.php <?php class CustomControllerAction extends Zend_Controller_Action { public $db; function init() { $this->db = Zend_Registry::get('db'); } } ?> I'll also include .htaccess: RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 And I'll include settings.ini: [development] database.type = pdo_mysql database.hostname = localhost database.username = phpweb20 database.password = myPassword (obviously changed) database.database = phpweb20 paths.base = /var/www/phpweb20 paths.data = /var/www/phpweb20/data paths.templates = /var/www/phpweb20/templates logging.file = /var/www/phpweb20/data/logs/debug.log The error I am receiving when I implement all of these is as follows: Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /var/www/phpweb20/include/Zend/Controller/Dispatcher/Standard.php:241 Stack trace: #0 /var/www/phpweb20/include/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /var/www/phpweb20/htdocs/index.php(18): Zend_Controller_Front->dispatch() #2 {main} thrown in /var/www/phpweb20/include/Zend/Controller/Dispatcher/Standard.php on line 241 Has anyone experienced similar problems? Does anyone have any idea on how to solve this? Any help is appreciated. Thanks!
  2. Ah, thanks! Now I just gotta figure out what to about restarting on a shared host...maybe there's something on their website...
  3. Right now I have to include this: #path to pear ini_set('include_path', "/home/fearandf/php"); On every php page - so I would like to edit php.ini so I don't need to. I found the include_path in the file and added a semicolon and then added the path above, but it doesn't work. That path does show up in the phpinfo() alright, but won't allow my scripts to run properly unless the ini_set is included. Anyone able to help me correctly edit php.ini?
  4. 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?
  5. .:/usr/lib/php:/usr/local/lib/php Is the include path - how can I check if that is where Pear directory is?
  6. 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...
  7. 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...
  8. 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
  9. 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.
  10. 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?
×
×
  • 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.