Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在由Web脚本启动的Cli脚本中重新创建Php Web会话_Php_Zend Framework - Fatal编程技术网

在由Web脚本启动的Cli脚本中重新创建Php Web会话

在由Web脚本启动的Cli脚本中重新创建Php Web会话,php,zend-framework,Php,Zend Framework,我使用Zend framework 1.12创建了一个php应用程序。有一个运行php cli脚本的Zend操作。会话id作为参数传递给cli脚本 由web应用程序和cli脚本共享的Zend Bootstrap.php protected function _initSession() { global $argv; $this->bootstrap('database'); if (APPLICATION_ENV == '

我使用Zend framework 1.12创建了一个php应用程序。有一个运行php cli脚本的Zend操作。会话id作为参数传递给cli脚本

由web应用程序和cli脚本共享的Zend Bootstrap.php



    protected function _initSession()
    {
        global $argv;

        $this->bootstrap('database');

        if (APPLICATION_ENV == 'testing') {
            require_once 'Zend/Session.php';
            Zend_Session::$_unitTestEnabled = true;
            return;
        }

        $config = array(
            'name' => 'session',
            'primary' => 'session_id',
            'modifiedColumn' => 'modified',
            'dataColumn' => 'data',
            'lifetimeColumn' => 'lifetime'
        );

        Zend_Session::writeClose(); //cancel the session's auto start,important

        $saveHandler = new Zend_Session_SaveHandler_DbTable($config);
        Zend_Session::setSaveHandler($saveHandler);

        if (defined('APPLICATION_TYPE')
                      && (APPLICATION_TYPE == 'cli' ||
                          APPLICATION_TYPE == 'standalone')) {

            //Restore the session and then start it. job_id:session
            $d = explode(':', $argv[1]);

            if (count($d) > 1) {
                $job_id = $d[1];
                if (!empty($job_id)) {
                    Zend_Session::setId($job_id);
                }
            }
        }

        Zend_Session::start();

        return null;
    }

我有一个从web脚本保存的会话,我想在cli脚本中访问该会话

该设置使用php版本5.5.14在mac上运行。它不能在php版本为5.3.10的linux服务器上工作


知道问题出在哪里吗?

我发现了问题。问题出在苏霍辛身上。suhosin的默认选项是加密会话id。我必须将encrypt设置为off

suhosion.session.encrypt=关闭