Question

I was trying to get an existing ZEND project running on my Raspberry Pi, but unfortunately, it throws this error:

Fatal error:  Uncaught exception 'Zend_Config_Exception' with message 'Section '' cannot be found in /var/www/BY_test/application/configs/session.ini' in /var/www/BY_test/library/Zend/Config/Ini.php:151 
Stack trace:
    #0 /var/www/BY_test/application/Bootstrap.php(41): Zend_Config_Ini->__construct('/var/www/BY_tes...', false)
    #1 /var/www/BY_test/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initSession()
    #2 /var/www/BY_test/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('session')
    #3 /var/www/BY_test/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL)
    #4 /var/www/BY_test/library/Zend/Application.php(355): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap(NULL)
    #5 /var/www/BY_test/public/index.php(44): Zend_Application->bootstrap()
    #6 {main}
thrown in /var/www/BY_test/library/Zend/Config/Ini.php on line 151

Since I'm new to Zend Framework, I'd really appreciate some help of someone more experienced.

I've already tried to find a solution myself, but the only post I found from someone with a similar problem was solved by deleting the getenv()-function for the APPLICATION_ENV in Bootstrap.php. Good for him, but that didn't do it for me.

It looks strange to me, that in the message the actual section is missing. I thought, this was an important clue, so I dabbled a little in some of the files mentioned in the error message, but like I said, I've only just begun working with Zend, so that was kind of pointless.

Also, I thought this was a matter of the operating system it's running on, since the project originally ran on a Windows server and I use Raspbian on the Pi. But I could (at least partially) rule this out.

Any ideas, what I could check next or what the problem might be?

FYI, the project's Zend Framework version is 1.12 and I use Apache/2.2.22 (Debian). If you need further information on anything, just tell me. I just didn't want to swamp you with needless information 'cause I have no idea, what you need to know.

Thanks in advance!

EDIT:

PHP version on the Pi is 5.4.4-14+deb7u7 (the version on the original Windows server is 5.4.16)

Contents of session.ini:

;#####################################
; setup sessions
;#####################################

[production]
name = FLOID_BACKYARD
save_path = APPLICATION_PATH "/../data/session"
use_only_cookies = true
remember_me_seconds = 864000

[development : production]
save_path = APPLICATION_PATH "/../data/session"
use_only_cookies = true
remember_me_seconds = 864000

and the __initSession function of Bootstrap.php (line 41 reads '$config = ...'):

protected function _initSession()
{
    $config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/session.ini', getenv('APPLICATION_ENV'));
    Zend_Session::setOptions($config->toArray());
    Zend_Session::start();
}
Was it helpful?

Solution

Based on the comments, the quick fix for you problem would be to change this line:

$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/session.ini', getenv('APPLICATION_ENV'));

to:

$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/session.ini', APPLICATION_ENV);

which is probably what it should be anyway. My guess is that on your other server, the environment variable was being set somewhere with SetEnv, but this isn't really necessary if you're running it in production mode.

OTHER TIPS

Set in .htaccess inside the /public

SetEnv APPLICATION_ENV development

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top