問題描述
我在嘗試設(shè)置我們正在運行的站點的測試副本時遇到問題,我在 Mint VM 下安裝了文件和應(yīng)用程序,當(dāng)我將 apache 指向目錄時,我收到 500 錯誤和以下內(nèi)容-
I'm having an issue trying to set up a testing copy of a site we have running, I have the files and applications installed under a Mint VM and when I point apache at the directory I get a 500 error and the following-
[Thu Oct 25 15:09:39.714201 2018] [php7:error] [pid 8945] [client 192.168.0.14:52237] PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/Object.php on line 30
[Thu Oct 25 15:09:39.714547 2018] [php7:error] [pid 8945] [client 192.168.0.14:52237] PHP Fatal error: Uncaught Error: Class 'Controller' not found in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php:174
Stack trace:
#0 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php(92): ExceptionRenderer->_getController(Object(InternalErrorException))
#1 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(126): ExceptionRenderer->__construct(Object(InternalErrorException))
#2 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(284): ErrorHandler::handleException(Object(InternalErrorException))
#3 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(213): ErrorHandler::handleFatalError(64, 'Cannot use 'Obj...', '/home/jamesmcgr...', 30)
#4 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/App.php(933): ErrorHandler::handleError(64, 'Cannot use 'Obj...', '/home/jamesmcgr...', 30, Array)
#5 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/App.php(906): App::_checkFatalError()
#6 [internal function]: App::shutdow in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php on line 174
奇怪的是,我們直接從運行正常的網(wǎng)絡(luò)服務(wù)器中提取了文件.第一個錯誤讓我相信這是由于 php 或 apache 版本根據(jù)我在其他地方閱讀的內(nèi)容不同(工作網(wǎng)絡(luò)服務(wù)器是 7.1.10,測試服務(wù)器是 7.2.10,我無法確定是什么版本的apache 網(wǎng)絡(luò)服務(wù)器正在運行).
The weird thing is we've ripped the files straight from the webserver, which is functioning correctly. The first error makes me believe that it's due to the php or apache versions being different based on what I've read elsewhere (the working webserver is 7.1.10 and the testing one is 7.2.10, I can't determine what version of apache the webserver is running).
我不確定這兩個錯誤是否相關(guān),我還在適應(yīng)這種環(huán)境,所以在學(xué)習(xí)這些東西方面進(jìn)展緩慢.
I'm not sure if the two errors are related, I'm still getting used to this environment so progress is slow picking up this stuff.
任何幫助都將不勝感激.
Any help at all would be greatly appreciated.
推薦答案
后一個錯誤是由前一個錯誤的問題引起的,前一個錯誤應(yīng)該是不言自明的,名稱Object
保留,不能再用作類名.
The latter error is caused by the problem that causes former error, and the former error should be rather self-explantory, the name Object
is reserved and cannot be used as class name anymore.
Object
在 PHP 7.2
中被軟保留后變成了 PHP 7.2
中的硬保留名稱.為了獲得適當(dāng)?shù)?PHP 7.2
兼容性,請將您的 CakePHP 依賴項升級到至少最新的 2.10.x
版本.
Object
has become a hard-reserved name in PHP 7.2
, after being soft-reserved as of PHP 7.0
. For proper PHP 7.2
compatibility, upgrade your CakePHP dependency to at least the latest 2.10.x
release.
如果您使用內(nèi)置加密,您還必須切換到 OpenSSL(請參閱 Security.useOpenSsl
配置選項),或者如果您的應(yīng)用程序使用的加密不是不兼容,通過 PECL 安裝 Mcrypt,或使用類似 phpseclib/mcrypt_compat的 polyfill一>.
If you are using the built-in encryption, you'll also have to either switch to OpenSSL (see the Security.useOpenSsl
configuration option), or if the encryption that your app is using isn't compatible, install Mcrypt via PECL, or use a polyfill like phpseclib/mcrypt_compat.
如果此時您無法升級 CakePHP,則必須將 PHP 安裝降級到 7.1.x
或更早版本.
If you cannot upgrade CakePHP at this moment, then you'll have to downgrade your PHP installation to 7.1.x
or earlier.
另見
- https://github.com/cakephp/cakephp/issues/11346
- 食譜> 核心庫> 實用程序> 安全性
- 說明書 > 附錄 > 遷移指南
- PHP 手冊 > 附錄> 從 PHP 7.1.x 遷移到 PHP 7.2.x > 向后不兼容的更改 > 類名的對象
- PHP 手冊 > 附錄> 從 PHP 7.1.x 遷移到 PHP 7.2.x > 其他更改 > 將 MCrypt 遷移到 PECL
這篇關(guān)于不能使用 'Object 作為類名,因為它是保留的 Cake 2.2.x的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!