我正在开发一个项目zend框架1.12其中一切都适用于localhost中的会话 在阅读了一些关于会话的文章之后,我为存储变量所做的一切都是命名空间的唯一声明,以下是在控制器或视图中:
$ session = new Zend_Session_Namespace ('session');
$ session-> var1 = $ var1
$ session-> var2 = $ var2
但在部署项目在线后,我总是收到以下错误:
Zend_Session :: start () - / var / www / vhosts / x.com / httpdocs / project / library / Zend / session.php (Line: 477): Error # 2 Class __ PHP_Incomplete_Class Has No unserializer
堆栈跟踪:
#0 /var/www/vhosts/x.com/httpdocs/project/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 /var/www/vhosts/x.com/httpdocs/project/application/controllers/IndexController.php(25): Zend_Session_Namespace->__construct('session')
#2 /var/www/vhosts/x.com/httpdocs/project/library/Zend/Controller/Action.php(516): IndexController->packageAction()
#3 /var/www/vhosts/x.com/httpdocs/project/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('packageAction')
#4 /var/www/vhosts/x.com/httpdocs/project/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#5 /var/www/vhosts/x.com/httpdocs/project/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#6 /var/www/vhosts/x.com/httpdocs/project/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#7 /var/www/vhosts/x.com/httpdocs/project/surf/index.php(26): Zend_Application->run()
#8 {main}
我真的在寻找解决方案而且我只知道问题的原因:我必须在bootstrap.php中声明
public function _initSession () {
Zend_Session :: start ();
}
在致电$ session = new Zend_Session_Namespace ('session');
之前,我必须致电Zend_Session :: start ();
我必须根据我在App.ini文件中的各种论坛中阅读的内容进行配置,但我真的不知道配置
我做了几次尝试,但没有结果我发现了如何组织事情以便这样做的问题。
我求求你帮助我,因为我必须尽快在线完成这个项目
答案 0 :(得分:1)
最后,这是我在bootstrap.php中没有触及任何内容的解决方案。我所做的一切都是添加一个名为sessions的目录(例如)
并在application.ini中添加以下行:
resources.session.save_path APPLICATION_PATH = "/ sessions /"