致命错误:访问未声明的静态属性:PhalconDi::$_default ..公共/索引.php在第 20 行


Fatal error: Access to undeclared static property: PhalconDi::$_default ....public/index.php on line 20

我已经在我的服务器 Centos 7 上安装了 Phalcon 和 PHP-FPM 5.6

我正在按照 https://docs.phalconphp.com/en/latest/reference/tutorial.html 的基本说明进行操作,并在开始时卡住:

有时它会显示正确的"Hello!"消息,但我已经多次刷新页面,大多数情况下我收到以下错误:

致命错误:访问未声明的静态属性:Phalcon''Di::$_default in/var/www/vhosts/playerm8.com/httpdocs/public/index.php 第 20 行

我的公共/索引.php看起来像这样:

<?php
use Phalcon'Loader;
use Phalcon'Mvc'View;
use Phalcon'Mvc'Application;
use Phalcon'Di'FactoryDefault;
use Phalcon'Mvc'Url as UrlProvider;
use Phalcon'Db'Adapter'Pdo'Mysql as DbAdapter;
try {
    // Register an autoloader
    $loader = new Loader();
    $loader->registerDirs(array(
        '../app/controllers/',
        '../app/models/'
    ))->register();
    // Create a DI
    $di = new FactoryDefault()
;
    // Setup the view component
    $di->set('view', function () {
        $view = new View();
        $view->setViewsDir('../app/views/');
        return $view;
    });
    // Setup a base URI so that all generated URIs include the "tutorial" folder
    $di->set('url', function () {
        $url = new UrlProvider();
        $url->setBaseUri('/');
        return $url;
    });
    // Handle the request
    $application = new Application($di);
    echo $application->handle()->getContent();
} catch ('Exception $e) {
     echo "Exception: ", $e->getMessage();
}

我的应用程序/控制器/索引控制器.php看起来像这样:

<?php
use Phalcon'Mvc'Controller;
class IndexController extends Controller
{
    public function indexAction()
    {
        echo "<h1>Hello!</h1>";
    }
}

任何帮助将不胜感激

我发现了问题,代码是正确的,但显然这与 Plesk 有关。我已经从服务器中删除了 Plesk 并安装了 Apache,它现在一直都可以工作。感谢回复的人:)