PHP 核心警告 – yii\base\ErrorException - Yii2

PHP Core Warning – yii\base\ErrorException - Yii2

我将我的网站上传到服务器后,发现一个错误偶尔会出现在我网站首页的底部。

这是当我允许调试模式时出现的错误:

知道如何解决这个问题吗?

PHP Core Warning – yii\base\ErrorException

PHP Startup: XCache: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
2. yii\base\ErrorHandler::handleFatalError()
$_GET = [
'r' => 'site/index',
];

$_SERVER = [
'PATH' => '/usr/local/bin:/usr/bin:/bin',
'ONECOM_DOMAIN_NAME' => 'aaa.org',
'ONECOM_DOMAIN_ROOT' => '/customers/f/1/0/aaa.org/',
'PHP_INI_SCAN_DIR' => '/customers/f/1/0/aaa.org//config/conf.d.php',
'ONECOM_TMPDIR' => '/customers/f/1/0/aaa.org//tmp',
'CONTENT_LENGTH' => '0',
'HTTP_CONNECTION' => 'close',
'SCRIPT_NAME' => '/basic/web/index.php',
'REQUEST_URI' => '/basic/web/index.php?r=site%2Findex',
'QUERY_STRING' => 'r=site%2Findex',
'REQUEST_METHOD' => 'GET',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'REMOTE_PORT' => '43417',
'SCRIPT_FILENAME' => '/customers/f/1/0/aaa.org/httpd.www/basic/web/index.php',
'SERVER_ADMIN' => 'support@one.com',
'REMOTE_ADDR' => '85.182.145.82',
'SERVER_PORT' => '80',
'SERVER_ADDR' => '10.246.64.54',
'SERVER_NAME' => 'aaa.org',
'SERVER_SOFTWARE' => 'Apache',
'SERVER_SIGNATURE' => '',
'HTTP_X_VARNISH' => '3001546637',
'HTTP_X_FORWARDED_FOR' => '85.182.145.82',
'HTTP_X_ONECOM_FORWARDED_PROTO' => 'http',
'HTTP_X_ONECOM_FORWARDED_IP' => '85.182.145.82',
'HTTP_COOKIE' => '_csrf=e7f478f7d6f77251f8f671cacdf107b7452851591bfd4f69530abf911b6bb569s%3A32%3A%22g2OYEa3GXCqowo7WrBxBsI04in_U63Jl%22%3B',
'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8,ar;q=0.6',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, sdch',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'HTTP_CACHE_CONTROL' => 'max-age=0',
'HTTP_HOST' => 'aaa.org',
'WEBC_USER_DOMAIN_NAME' => 'aaa.org',
'DOMAIN_NAME' => 'aaa.org',
'WEBC_USER_DOCUMENT_ROOT' => '/customers/f/1/0/aaa.org/httpd.www',
'ONECOM_DOCUMENT_ROOT' => '/customers/f/1/0/aaa.org/httpd.www',
'DOCUMENT_ROOT' => '/customers/f/1/0/aaa.org/httpd.www',
'ONECOM_CLIENT_IP' => '85.182.145.82',
'FCGI_ROLE' => 'RESPONDER',
'PHP_SELF' => '/basic/web/index.php',
'REQUEST_TIME_FLOAT' => 1424618360.1619689464569091796875,
'REQUEST_TIME' => 1424618360,
];

$_COOKIE = [
'_csrf' => 'e7f478f7d6f77251f8f671cacdf107b7452851591bfd4f69530abf911b6bb569s:32:"g2OYEa3GXCqowo7WrBxBsI04in_U63Jl";',
];

在多次联系共享主机客户支持后,我们最终通过执行以下操作解决了问题:

  • 他们禁用了我网站的 xcache
  • 我使用 PHP 5.5 开发网站,但我在共享主机网站配置中使用 PHP 5.6。所以,我不得不 return 回到 PHP 5.5
  • 我必须通过将这行代码添加到我的 .htaccess

    来禁用 "varnish cache"
     Header add "disablevcache" "true"