Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZF]Błąd - 'Cannot load controller class "IndexController"
kociou1
post 6.03.2008, 15:18:21
Post #1





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 13.02.2004
Skąd: warszawa

Ostrzeżenie: (0%)
-----


mam kod bootstrapera wzięty z tutoriala:
  1. <?php
  2. ini_set('display_errors', 'on');
  3. date_default_timezone_set('Europe/London');
  4. set_include_path('.' . PATH_SEPARATOR . './library'
  5.  . PATH_SEPARATOR . './application/models/'
  6.  . PATH_SEPARATOR . get_include_path());
  7.  
  8. include "Zend/Loader.php";
  9. Zend_Loader::loadClass('Zend_Controller_Front');
  10.  
  11. // setup controller
  12. $frontController = Zend_Controller_Front::getInstance();
  13. $frontController -> setBaseUrl('/zend/');
  14. $frontController->throwExceptions(true);
  15. $frontController->setControllerDirectory('./application/controllers');
  16.  
  17. // run!
  18. $frontController->dispatch();
  19. ?>


wszystkie pliki są na miejscu, odpowiedznio sie nazywają, mod_rewrite włączone, htaccess:
Cytat
RewriteEngine on
RewriteRule .* index.php

i co bym nie robił na lokalu wywala błąd:
Cytat
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Cannot load controller class "IndexController" from file "IndexController.php" in directory "\"' in G:\Strony\zend\library\Zend\Controller\Dispatcher\Standard.php:295 Stack trace: #0 G:\Strony\zend\library\Zend\Controller\Dispatcher\Standard.php(212): Zend_Controller_Dispatcher_Standard->loadClass('IndexController') #1 G:\Strony\zend\library\Zend\Controller\Front.php(931): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #2 G:\Strony\zend\index.php(19): Zend_Controller_Front->dispatch() #3 {main} thrown in G:\Strony\zend\library\Zend\Controller\Dispatcher\Standard.php on line 295

w sieci wszystko działa poprawnie
drogą dedukcji dochodze do wniosku że przeoczyłem coś w konfiguracji lokalnego serwera... tylko co?

Ten post edytował Cysiaczek 7.03.2008, 12:58:36
Powód edycji: dodalem tag (cysiaczek)
Go to the top of the page
+Quote Post
roofy_1
post 6.03.2008, 15:33:20
Post #2





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 12.02.2008

Ostrzeżenie: (0%)
-----


Witaj!!!
Cytat
wszystkie pliki są na miejscu, odpowiedznio sie nazywają, mod_rewrite włączone, htaccess:
Kod PHP1
2
3
4
<?php
RewriteEngine on
RewriteRule .* index.php
?>


w pliku .htaccess nie używaj php

Pozdr,
Go to the top of the page
+Quote Post
kociou1
post 6.03.2008, 15:47:47
Post #3





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 13.02.2004
Skąd: warszawa

Ostrzeżenie: (0%)
-----


nie używam... jakoś mi sie tak na forum wpisało smile.gif
Go to the top of the page
+Quote Post
roofy_1
post 6.03.2008, 16:03:17
Post #4





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 12.02.2008

Ostrzeżenie: (0%)
-----


php_flag magic_quotes_gpc off
php_flag register_globals off

masz to powyłączane?
Go to the top of the page
+Quote Post
yankes
post 6.03.2008, 16:45:38
Post #5





Grupa: Zarejestrowani
Postów: 41
Pomógł: 1
Dołączył: 13.01.2006

Ostrzeżenie: (0%)
-----


wpisz tak: $frontController->setControllerDirectory('/application/controllers');
Go to the top of the page
+Quote Post
MarcinTryka
post 7.03.2008, 12:52:36
Post #6





Grupa: Zarejestrowani
Postów: 56
Pomógł: 0
Dołączył: 31.03.2007

Ostrzeżenie: (0%)
-----


Witam mam ten sam problem po wgraniu najnowszej wersji ZF.
Wcześniej przy aplikacji którą buduję używałem 1.0.3, nasępnie 1.5.0 PR i było bez żadnych problemów. Wgrałem nowy ZF 1.5.0 RC1 (w miejsce starego tak jak poprzednio, ścieżki nie powinny się zmienić) i wyskakuje mi:

<span style="font-weight: bold;"><a href="http://pl.php.net/Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' with message 'Action "index" does not exist and was not trapped in __call()' in /home/***/public_html/portal/library/Zend/Controller/Action.php:477 Stack trace: #0 /home/***/public_html/portal/library/Zend/Controller/Action.php(504): Zend_Controller_Action->__call('indexAction', Array) #1 /home/***/public_html/portal/library/Zend/Controller/Dispatcher/Standard.php(293): Zend_Controller_Action->dispatch('indexAction') #2 /home/***/public_html/portal/library/Zend/Controller/Front.php(914): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #3 /home/***/public_html/portal/index.php(36): Zend_Controller_Front->dispatch() #4 {main} thrown in /home/***/public_html/portal/library/Zend/Controller/Action.php on line 477" title="Zobacz w manualu PHP" target="_manual">
Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' with message 'Action "index" does not exist and was not trapped in __call()' in /home/***/public_html/portal/library/Zend/Controller/Action.php:477 Stack trace: #0 /home/***/public_html/portal/library/Zend/Controller/Action.php(504): Zend_Controller_Action->__call('indexAction', Array) #1 /home/***/public_html/portal/library/Zend/Controller/Dispatcher/Standard.php(293): Zend_Controller_Action->dispatch('indexAction') #2 /home/***/public_html/portal/library/Zend/Controller/Front.php(914): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #3 /home/***/public_html/portal/index.php(36): Zend_Controller_Front->dispatch() #4 {main} thrown in /home/***/public_html/portal/library/Zend/Controller/Action.php on line 477
</a></span>

I nie mam pojęcia jak to obejść. Jak podmieniam katalog Zend na Zend_old (zamienię nazwy ze starszą wersją) to wszystko wraca do normy. Moj index.php:
  1. <?php 
  2. error_reporting(E_ALL|E_STRICT); 
  3. date_default_timezone_set('Europe/London'); 
  4.  
  5. set_include_path('.' . PATH_SEPARATOR . './library' 
  6. . PATH_SEPARATOR . './application/models/' 
  7. . PATH_SEPARATOR . get_include_path());
  8.  
  9. include "Zend/Loader.php"; 
  10.  
  11. Zend_Loader::loadClass('Zend_Controller_Front'); 
  12. Zend_Loader::loadClass('Zend_Config_Ini');
  13.  Zend_Loader::loadClass('Zend_Filter_StripTags');
  14. Zend_Loader::loadClass('Zend_Registry');
  15. Zend_Loader::loadClass('Zend_Db'); 
  16. Zend_Loader::loadClass('Zend_Db_Table');
  17. Zend_Loader::loadClass('Zend_Debug');
  18. Zend_Loader::loadClass('Zend_Auth');
  19. Zend_Loader::loadClass('Zend_Session');
  20. Zend_Loader::loadClass('KontrolerGlowny');
  21.  
  22. // setup controller 
  23. $frontController = Zend_Controller_Front::getInstance(); 
  24. $frontController->throwExceptions(true); 
  25. // $frontController->setControllerDirectory(array('default' => './application/controllers','admin' => './application/admin/controllers')); 
  26. $frontController->setControllerDirectory('./application/controllers'); 
  27.  
  28. $config = new Zend_Config_Ini('./application/config.ini', 'general'); 
  29. $registry = Zend_Registry::getInstance(); 
  30. $registry->set('config', $config);
  31.  
  32. $db = Zend_Db::factory( $config->db->adapter, $config->db->config->toArray());
  33. Zend_Db_Table::setDefaultAdapter($db);
  34. Zend_Registry::set('db', $db);
  35. $db->query('Set names utf8');
  36. $frontController->dispatch();
  37. ?>

Plik .htaccess:
<span style="font-weight: bold;"><a href="http://pl.php.net/RewriteEngine onRewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php" title="Zobacz w manualu PHP" target="_manual">RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php</a></span>

NA starszych wersjach to wszystko ładnie śmiga. Pomocy!

Edit / Rozwiązanie

Ja juz znalazlem rozwiazanie, może się komuś przyda:

  1. <?php
  2. function indexController //poprawnie
  3. function IndexController //niepoprawnie
  4. ?>


W poprzednich wersjach to przechodziło, w tej natomiast nie :/

Ten post edytował MarcinTryka 7.03.2008, 12:53:27
Go to the top of the page
+Quote Post
Sabistik
post 7.03.2008, 12:57:51
Post #7


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

Ostrzeżenie: (0%)
-----


To prawda. Pozmieniały się trochę sposoby nazewnictwa w 1.5
Więcej szczegółów: http://framework.zend.com/manual/en/zend.c...moneohtoonefive
Go to the top of the page
+Quote Post
kociou1
post 7.03.2008, 14:01:28
Post #8





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 13.02.2004
Skąd: warszawa

Ostrzeżenie: (0%)
-----


Cytat(roofy_1 @ 6.03.2008, 18:03:17 ) *
php_flag magic_quotes_gpc off
php_flag register_globals off

masz to powyłączane?

taK - jest wyłączone

Cytat(yankes @ 6.03.2008, 18:45:38 ) *
wpisz tak: $frontController->setControllerDirectory('/application/controllers');

niestety nie pomogło smile.gif

Ten post edytował kociou1 7.03.2008, 14:18:38
Go to the top of the page
+Quote Post
roofy_1
post 10.03.2008, 12:39:45
Post #9





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 12.02.2008

Ostrzeżenie: (0%)
-----


Witaj!!
Powiem w ten sposób ja w poprzednim tygodniu pisałem wszystkie skrypty zodnie z tym tutorialem i wszystko działa; trzeb atylko zwraciać jeśli się kopijue uwagę na apostrofy ale jest ok

Pozdr,
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.05.2024 - 10:36