Witam,

Siedzę nad swoją aplikacją w zendzie i za nic w świecie nie potrafię jej zrozumieć. Po odpaleniu wyskakuje błąd:

Kod
Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Section 'general' cannot be found in ./application/config.ini' in [tutaj_poprawna_sciezka]/Ini.php:151 Stack trace: #0 /home/uzytkownik/domains/domena/public_html/index.php(15): Zend_Config_Ini->__construct('./application/c...', Array) #1 {main} thrown in [tutaj_poprawna_sciezka]/Ini.php on line 151


Błąd oznacza tyle, że nie może wczytaj sekcji "general" z pliku config.php a to by wskazywało na to, że ścieżki są złe, ale chcąc się upewnić to w pliku config.ini ustawiłem niepoprawne dane do bazy danych i pojawiał się już komunikat o tym, że zostały podane niepoprawne dane do bazy, po zmianie znowu na poprawne błąd odnośnie sekcji general pojawia się dalej.

W index.php wczytuję to w ten sposób (Linia 15):

  1. <?php
  2. ini_set('magic_quotes_gpc','off');
  3.  
  4. date_default_timezone_set('Europe/Warsaw');
  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. Zend_Loader::registerAutoload();
  11. Zend_Session::start();
  12. // Load configuration data from ini file
  13. $config = new Zend_Config_Ini('./application/config.ini', array('general','database','debug'));
  14.  
  15. // Setup database
  16. $db = Zend_Db::factory(
  17. $config->db->adapter,
  18. $config->db->config->toArray()
  19. );
  20. $db->query('SET CHARSET '.$config->db->config->charset.';');
  21. Zend_Db_Table::setDefaultAdapter($db);
  22. Zend_Registry::set('db', $db);
  23. Zend_Registry::set('baseHref', $config->server->baseHref);
  24.  
  25. // Setup controller
  26. $frontController = Zend_Controller_Front::getInstance();
  27. $frontController->throwExceptions(true);
  28. $frontController->setBaseUrl($config->server->baseUrl);
  29. $frontController->setControllerDirectory('./application/controllers');
  30.  
  31. // Router settings load from ini file
  32. $config = new Zend_Config_Ini('./application/routes.ini', 'production');
  33. $router = new Zend_Controller_Router_Rewrite();
  34. $router->addConfig($config, 'routes');
  35.  
  36. // Router subdomains
  37. $serverHost = explode('.', $_SERVER['HTTP_HOST']);
  38. $serviceUrl = explode('.', Zend_Registry::get('baseHref'));
  39. if(count($serverHost) > count($serviceUrl) && $serverHost[0]!='www') {
  40. $subdomain = $serverHost[0];
  41. $router->addRoute(
  42. 'subdomain',
  43. new Zend_Controller_Router_Route(':controller/:action/:subdomain',
  44. array('subdomain' => $subdomain,
  45. 'page' => 1,
  46. 'controller' => 'adv',
  47. 'action' => 'subdomain'))
  48. );
  49. }
  50.  
  51. $frontController->setRouter($router);
  52.  
  53. // Zend_Layout
  54. Zend_Layout::startMvc();
  55.  
  56. // Run
  57. $frontController->dispatch();


A mój config.ini wygląda tak:

Kod
[general]
   server.baseUrl       =
   server.baseHref      = http://www.domena.pl/
  
[database]
    db.adapter          = PDO_MYSQL
    db.config.host      = localhost
    db.config.username  = uzytkownik
    db.config.password  = haslo
    db.config.dbname    = nazwa_bazy
    db.config.charset   = utf8

[debug]
   debug.status         = false


Będę wdzięczny za jakiekolwiek wskazówki, żeby coś z tym wykombinować, bo już czepiałem się nawet chmodów i magic_quotes.

Pozdrawiam,
Ravik