Failed saving metadata to metadataCache

2019-08-03 02:29发布

问题:

I did a lot digging around for a solution to this problem and was unable to come to a solution.

Problem: I have a Zend Framework 1.10.7 application running on the terminal and through a web interface. When it is running over the web it works flawlessly but when I run it through command line it keeps giving me an error

Notice: Failed saving metadata to metadataCache

I looked at various other topics including Accessing the Zend Application Bootstrap _init Functions After Bootstrapping and I was still unable to solve the problem because I really couldn't follow what was going on there. It seems to be the same problem but I just couldn't understand what to do.

Could someone please help me out with this?

Here is the basic of what I have:

Bootstrap

protected function _initRouter()
{
    if (PHP_SAPI == 'cli') {
        $this->bootstrap('frontcontroller');
        $front = $this->getResource('frontcontroller');
        $front->setRouter(new PP_Tasks_Init());
        //$front->setRequest(new Zend_Controller_Request_Simple());
    }
}

回答1:

Make sure that the user of the command line and web have the right permissions to access the Zend_Cache backend.

I would run the command line application under same user like your web application or try do change the settings of Zend_Cache-backend and the underlying application. You find more information about Zend_Cache_Backend here.



回答2:

In you php.ini file please enable APC for cli mode as well,

Not very sure about the variable but it would be like as below

apc-cli-enable = 1

Also don't forget to restart the Apache to see changes