+ Reply to Thread
Results 1 to 1 of 1

Thread: autoloader isn't working as expected

  1. #1
    YorianBenjamin is offline Junior Member
    Join Date
    Oct 2009
    Posts
    3

    Default autoloader isn't working as expected

    Dear ZF-guru's,

    [FIXED]

    Today I've spent my day trying to put a website, that works fine locally, online. However when I put it online it seems to work at first and loads the view of the index controller and index action (nothing special there). And when I go to /authentication/login it still works. But when I sent the form ZF seems to have difficulty with the Zend_Loader.

    My system runs on php 5.2.11.

    The error I get:

    Code:
    Warning: include_once(Zend/Auth/Adapter/Dbtable.php) [function.include-once]: failed to open stream: No such file or directory in /home/sitede01/domains/sitedezign.net/library/Zend/Loader.php on line 146
    
    Warning: include_once() [function.include]: Failed opening 'Zend/Auth/Adapter/Dbtable.php' for inclusion (include_path='/home/sitede01/domains/sitedezign.net/application/../library:/home/sitede01/domains/sitedezign.net/library/.:/usr/local/lib/php') in /home/sitede01/domains/sitedezign.net/library/Zend/Loader.php on line 146
    
    Fatal error: Class 'Zend_Auth_Adapter_Dbtable' not found in /home/sitede01/domains/sitedezign.net/application/controllers/AuthenticationController.php on line 61
    My index.php:
    Code:
    <?php
    
    // Define path to application directory
    defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
    
    // Define application environment
    defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
    
    // Ensure library/ is on include_path
    set_include_path(implode('/', array(
        realpath(APPLICATION_PATH . '/../library'),
        get_include_path(),
    )));
    
    /*
     * This makes sure the sessions are deleted when the browser is closed.
     * If this is set to a long time it is possible to work without cookies,
     * however it would make anonymous login impossible.
     * 
     */
    ini_set('session.cookie_lifetime',0);	
    
    /*
     * set locale options to dutch
     */
    date_default_timezone_set('Europe/Amsterdam');
    
    /** Zend_Application */
    require_once 'Zend/Application.php';
    
    // Create application, bootstrap, and run
    $application = new Zend_Application(
        APPLICATION_ENV,
        APPLICATION_PATH . '/configs/application.ini'
    );
    
    $application->bootstrap()
                ->run();
    And the controller:
    Code:
    <?php
    
    class AuthenticationController extends Zend_Controller_Action
    {
    	private $redirector		= null;
    	
    	public function init(){
    		$this->redirector = $this->_helper->getHelper('Redirector');
    	}
    
    	public function loginAction()
    	{
    		
    		$auth = Zend_Auth::getInstance();
    		$authStorage = $auth->getStorage();
    		if(!$authStorage->isEmpty()){
    			$this->redirector->gotoUrl('/');
    		}	
    		
    		$this->view->title = 'Login';
    		$this->view->headTitle($this->view->title, 'PREPEND');
    
    		$form = new Form_AuthenticationLogin();
    		
    		if($this->getRequest()->isPost()){
    			$formData = $this->getRequest()->getPost();
    			
    			if($form->isValid($formData)){
    				$naam = $form->getValue('naam');
    				$password = $form->getValue('password');
    				
    				$authAdapter = $this->getAuthAdapter();
    				$authAdapter->setIdentity($naam)
    							->setCredential($password);
    							
    				$result = $authAdapter->authenticate();
    				if($result->isValid()){
    					$authStorage->write($authAdapter->getResultRowObject(null, 'pass'));
    					$this->redirector->gotoSimple('list', 'courses');
    				}else{
    					$form->populate($formData);
    					$this->view->content = $form;
    				}
    			}else{
    				$form->populate($formData);
    				$this->view->content = $form;
    			}
    		}else{
    			$this->view->content = $form;
    		}
    	}
    
    	private function getAuthAdapter()
    	{
    		$authAdapter = new Zend_Auth_Adapter_Dbtable(Zend_Db_Table::getDefaultAdapter());
    		$authAdapter->setTableName('auth')
    					->setIdentityColumn('name')
    					->setCredentialColumn('pass')
    					->setCredentialTreatment('SHA1(?)');
    		return $authAdapter;
    	}
    }
    Anybody that knows what going wrong?
    Last edited by YorianBenjamin; 03-12-2010 at 11:26 AM. Reason: Problem occured because of typos

+ Reply to Thread

Similar Threads

  1. Problem with the Autoloader, couldn't load my model
    By Dahliz91 in forum Core Infrastructure
    Replies: 0
    Last Post: 03-10-2010, 08:21 PM
  2. $this->url is not as I expected?
    By azz0r in forum General Q&A on Zend Framework
    Replies: 1
    Last Post: 02-10-2010, 05:13 PM
  3. Quickstart autoloader
    By replicator in forum Installation & Configuration
    Replies: 3
    Last Post: 10-14-2009, 06:07 AM
  4. Acl not behaving as expected...
    By DSmith in forum Authentication & Authorization
    Replies: 0
    Last Post: 05-08-2008, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts