PHP interesse |
|
Hallo,
Ik ben sinds kort bezig met Zend, en ben nu de Quickstart aan het volgen. Helaas wil mijn host de document root niet aanpassen en staat de public folder nu gewoon in de root folder, hiervoor heb ik in index.php een aantal mappen aangepast, zodat de includes allemaal kloppen. Index.php bevat momenteel:
<?php
// public/index.php
//
// Step 1: APPLICATION_PATH is a constant pointing to our
// application/subdirectory. We use this to add our "library" directory
// to the include_path, so that PHP can find our Zend Framework classes.
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application/'));
set_include_path(
APPLICATION_PATH . '/../library'
. PATH_SEPARATOR . get_include_path()
);
// Step 2: AUTOLOADER - Set up autoloading.
// This is a nifty trick that allows ZF to load classes automatically so
// that you don't have to litter your code with 'include' or 'require'
// statements.
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();
// Step 3: REQUIRE APPLICATION BOOTSTRAP: Perform application-specific setup
// This allows you to setup the MVC environment to utilize. Later you
// can re-use this file for testing your applications.
// The try-catch block below demonstrates how to handle bootstrap
// exceptions. In this application, if defined a different
// APPLICATION_ENVIRONMENT other than 'production', we will output the
// exception and stack trace to the screen to aid in fixing the issue
try {
require 'application/bootstrap.php';
} catch (Exception $exception) {
echo '<html><body><center>'
. 'An exception occured while bootstrapping the application.';
if (defined('APPLICATION_ENVIRONMENT')
&& APPLICATION_ENVIRONMENT != 'production'
) {
echo '<br /><br />' . $exception->getMessage() . '<br />'
. '<div align="left">Stack Trace:'
. '<pre>' . $exception->getTraceAsString() . '</pre></div>';
}
echo '</center></body></html>';
exit(1);
}
// Step 4: DISPATCH: Dispatch the request using the front controller.
// The front controller is a singleton, and should be setup by now. We
// will grab an instance and call dispatch() on it, which dispatches the
// current request.
Zend_Controller_Front::getInstance()->dispatch();
<?php // public/index.php // // Step 1: APPLICATION_PATH is a constant pointing to our // application/subdirectory. We use this to add our "library" directory // to the include_path, so that PHP can find our Zend Framework classes. APPLICATION_PATH . '/../library' ); // Step 2: AUTOLOADER - Set up autoloading. // This is a nifty trick that allows ZF to load classes automatically so // that you don't have to litter your code with 'include' or 'require' // statements. require_once "Zend/Loader.php"; Zend_Loader::registerAutoload(); // Step 3: REQUIRE APPLICATION BOOTSTRAP: Perform application-specific setup // This allows you to setup the MVC environment to utilize. Later you // can re-use this file for testing your applications. // The try-catch block below demonstrates how to handle bootstrap // exceptions. In this application, if defined a different // APPLICATION_ENVIRONMENT other than 'production', we will output the // exception and stack trace to the screen to aid in fixing the issue try { require 'application/bootstrap.php'; } catch (Exception $exception) { echo '<html><body><center>' . 'An exception occured while bootstrapping the application.'; if (defined('APPLICATION_ENVIRONMENT') && APPLICATION_ENVIRONMENT != 'production' ) { echo '<br /><br />' . $exception->getMessage() . '<br />' . '<div align="left">Stack Trace:' . '<pre>' . $exception->getTraceAsString() . '</pre></div>'; } echo '</center></body></html>'; } // Step 4: DISPATCH: Dispatch the request using the front controller. // The front controller is a singleton, and should be setup by now. We // will grab an instance and call dispatch() on it, which dispatches the // current request. Zend_Controller_Front::getInstance()->dispatch();
Als ik nu naar http://localhost ga krijg ik de volgende errror:
[error=php]
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\xampp\htdocs\library\Zend\Controller\Dispatcher\Standard.php:241 Stack trace: #0 C:\xampp\htdocs\library\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 C:\xampp\htdocs\index.php(48): Zend_Controller_Front->dispatch() #2 {main} thrown in C:\xampp\htdocs\library\Zend\Controller\Dispatcher\Standard.php on line 241[/error]
Weet iemand wat dit te betekenen heeft?
Tom
PS: Bedacht me net dat een screentje van de mappen handig kan zijn: http://img253.i...eenvk8.gif
|