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):
<?php date_default_timezone_set('Europe/Warsaw'); . PATH_SEPARATOR . './application/models/' include "Zend/Loader.php"; Zend_Loader::registerAutoload(); Zend_Session::start(); // Load configuration data from ini file // Setup database $db = Zend_Db::factory( $config->db->adapter, $config->db->config->toArray() ); $db->query('SET CHARSET '.$config->db->config->charset.';'); Zend_Db_Table::setDefaultAdapter($db); Zend_Registry::set('db', $db); Zend_Registry::set('baseHref', $config->server->baseHref); // Setup controller $frontController = Zend_Controller_Front::getInstance(); $frontController->throwExceptions(true); $frontController->setBaseUrl($config->server->baseUrl); $frontController->setControllerDirectory('./application/controllers'); // Router settings load from ini file $config = new Zend_Config_Ini('./application/routes.ini', 'production'); $router = new Zend_Controller_Router_Rewrite(); $router->addConfig($config, 'routes'); // Router subdomains $subdomain = $serverHost[0]; $router->addRoute( 'subdomain', new Zend_Controller_Router_Route(':controller/:action/:subdomain', 'page' => 1, 'controller' => 'adv', 'action' => 'subdomain')) ); } $frontController->setRouter($router); // Zend_Layout Zend_Layout::startMvc(); // Run $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
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