我的应用中的所有请求都遇到了问题。在大约20%的请求中返回以下错误,无论具体请求如何,基于请求的频率似乎都是不分青红皂白的。当我决定在我的新计算机上本地运行应用程序时,这个问题就出现了,所以我猜这是一个环境问题。鉴于它的不频繁和我对Slim核心的不熟悉,我觉得无法解决这个问题。
我正在运行PHP-FPM - 运行PHP 5.3.27 - 在Nginx之上。我正在运行Slim 2.4.0如果您需要知道任何php.ini值,PHP安装中的模块或其他任何相关内容,请告诉我。由于这是应用程序的全局问题,我不确定要包含哪些代码。非常感谢你的帮助。
Notice: Undefined property: Slim\Slim::$container in Slim/Slim.php on line 234
Notice: Indirect modification of overloaded property Slim\Slim::$container has no effect in Slim/Slim.php on line 239
Notice: Undefined property: Slim\Slim::$container in Slim/Slim.php on line 234
Notice: Indirect modification of overloaded property Slim\Slim::$container has no effect in Slim/Slim.php on line 155
Notice: Undefined property: Slim\Slim::$container in Slim/Slim.php on line 234
Fatal error: Call to a member function singleton() on a non-object in Slim/Slim.php on line 158
下面是我的index.php的顶部(其中所有非文件请求都被路由),显示了\ Slim \ Slim对象的实例化。在config.php中只有常量定义,所有响应都在以下行中定义:
/**
* Define Constants
*/
require_once 'config.php';
/**
* Require the Slim Framework
*
* If you are not using Composer, you need to require the
* Slim Framework and register its PSR-0 autoloader.
*
* If you are using Composer, you can skip this step.
*/
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
/**
* Instantiate a Slim application
*
* This example instantiates a Slim application using
* its default settings. However, you will usually configure
* your Slim application now by passing an associative array
* of setting names and values into the application constructor.
*/
$app = new \Slim\Slim(array(
'mode' => 'development',
'debug' => false,
'log.enabled' => false,
'templates.path' => APPPATH . '/templates',
'cookies.encrypt' => true,
'cookies.lifetime' => '12 hour',
'cookies.secret_key' => '$apr1$4s961sza$txDJLrSg2suGYqkWf24wL.'
));
$res = $app->response();
$res['Content-Type'] = 'application/json';