Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Pages: 1
Bonjour,
Pouvez-vous m'aider, j'essaye d'utiliser zend Framework sur easyPHP. Je suis ce tuto http://g-rossolini.developpez.com/tutor … ter/?page= et dès le dbut j'ai un problème. J'obtien le message d'erreur suivant:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index)' in C:\Program Files\EasyPHP 2.0b1\www\HAMVC\library\Zend\Controller\Dispatcher\Standard.php:198 Stack trace: #0 C:\Program Files\EasyPHP 2.0b1\www\HAMVC\library\Zend\Controller\Front.php(929): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 C:\Program Files\EasyPHP 2.0b1\www\HAMVC\index.php(21): Zend_Controller_Front->dispatch() #2 {main} thrown in C:\Program Files\EasyPHP 2.0b1\www\HAMVC\library\Zend\Controller\Dispatcher\Standard.php on line 198
Je ne compren pas. J'ai mis la library zend dans C:\Program Files\EasyPHP 2.0b1\php5 et j'ai mis dans le fichier php.ini include_path = ".;c:\php\includes;C:\Program Files\EasyPHP 2.0b1\php5"
Dans mon .htaccess j'ai mis:
RewriteEngine on RewriteRule .* index.php php_flag magic_quotes_gpc off php_flag register_globals off
et dan smon index.php:
<?php error_reporting(E_ALL|E_STRICT); date_default_timezone_set('Europe/London'); set_include_path('.' . PATH_SEPARATOR . '../HAMVC/library' . PATH_SEPARATOR . '..HAMVC/application/models' . PATH_SEPARATOR . get_include_path()); echo get_include_path(); include "Zend\Loader.php"; Zend_Loader::loadClass('Zend_Controller_Front'); // setup controller $frontController = Zend_Controller_Front::getInstance(); $frontController->throwExceptions(true); $frontController->setControllerDirectory('../application/controllers'); // run! $frontController->dispatch();
merci de votre aide.
Dernière modification par assifa (03-02-2008 20:53:15)
Hors ligne
Le problème ne vient pas de la librairie (enfin si mais non)
Le front controller n'arrive pas à trouvé le controller index qui devrait si situer dans "/application/controllers/IndexController.php".
Si tu n'utilise pas la racine de ton serveur (comme par exemple pour http://127.0.0.1/testZF/") tu dois le préciser au front ainsi $frontController->setBasPath('testZF') il me semble.
PS: voici un précédent problème rencontré avec easyPhp http://www.z-f.fr/forum/viewtopic.php?id=667 mais ça n'a pas l'air lié
NB: Merci d'utiliser les balise [code ][/ code] pour le code... C'est plus lisible. Merci
Hors ligne
Je te remercie,j'ai reussi à resoudre mon problème.
Cependant je me suis confronté a un autre problème, toujours au début du tuto je créer les vues, j'arrive a acceder a http://127.0.0.1/HAMVC/ cependant je n'arrive pas a acceder a http://127.0.0.1/HAMVC/index/ajouter alors k j'ai une action ajouter dans mon controler qui es le suivant:
<?php class IndexController extends Zend_Controller_Action { function init() { $this->view->baseUrl = $this->_request->getBaseUrl(); } function indexAction() { echo "indexAction"; $this->view->title = "Mes albums"; } function ajouterAction() { echo "ajouterAction"; $this->view->title = "Ajouter un nouvel album"; } function modifierAction() { $this->view->title = "Modifier un album"; } function supprimerAction() { $this->view->title = "Supprimer un album"; } }
et j'ai un fichier ajouter.phtml dans C:\Program Files\EasyPHP 2.0b1\www\HAMVC\application\views\scripts\index.
Je ne compren donc pas d'ou vien le problème.
EDIT Admin: Pour baliser le code c'est [code ] (sans espace ). Merci
Hors ligne
Pages: 1