CKfinder3版本冲突
項(xiàng)目場(chǎng)景:開發(fā)文檔版本編輯器版本沖突問題
開發(fā)需求:開發(fā)文檔編輯和版本控制器
???????使用PHP開發(fā)一個(gè)文檔版本控制器,可以編輯文檔,記錄每次歷史版本,可以瀏覽歷史記錄中的每個(gè)版本,以及導(dǎo)出為PDF,Word文件。
開發(fā)相關(guān)技術(shù):
PHP5.6.9nts版本,Apache2.4.39版本,MySQL5.7.26版本,CKfinder3,CKEditor5?? ? ?
問題描述:因?yàn)镻HP版本過低導(dǎo)致報(bào)錯(cuò)版本沖突問題
編輯器部分使用CKEditor5,而上傳圖片功能使用CKfinder3,但是因?yàn)镻HP版本過低,是5.6.9nts版本的,所以報(bào)錯(cuò)版本沖突問題,如下圖:
?
Fatal error:Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". You are running 5.4.45. in?
原因分析:PHP版本過低,以及CKfinder3中配置文件中強(qiáng)制規(guī)定PHP版本
PHP版本過低,很多語法不支持,而CKfinder3是最新的,所以在CKfinder3中配置文件中強(qiáng)制規(guī)定PHP版本。如下圖代碼,70300表示7.3版本,獲取當(dāng)前PHP版本并判斷是否大于7.3,小于7.3直接報(bào)錯(cuò)。
文件位置:ckfinder\core\connector\php\vendor\composer\platform_check.php文件
解決方案:調(diào)整?CKfinder版本
下面是解決思路和步驟,錯(cuò)誤的思路也一同記錄下來參考。
?錯(cuò)誤思路:
如上圖所示,既然判斷版本問題,那把7.3改為當(dāng)前版本是否可行。
if (!(PHP_VERSION_ID >= 50609)) {$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.'; }?結(jié)果:?Parse error: syntax error, unexpected ':', expecting '{' in
即使通過版本判斷,語法也不對(duì),所以這種方法PASS。
保錯(cuò)文件位置:ckfinder\core\connector\php\vendor\symfony\polyfill-php80\bootstrap.php
?
?正確解決思路:
辦法:調(diào)整?CKfinder版本。
在CKfinder官網(wǎng)中,最下方可以選擇任意版本下載。
下載地址:
CKFinder - Download Latest Versionhttps://ckeditor.com/ckfinder/download/?null-addons=
?插一句,因?yàn)橹坝玫氖?.5.45nts版本,所以還報(bào)了下方的錯(cuò)。所以下載時(shí)需要根據(jù)自己的PHP版本來,不知道需要什么版本的就先下一個(gè),然后根據(jù)報(bào)錯(cuò)選擇重新下載相應(yīng)版本或是調(diào)整PHP版本。
?翻譯:PHP安裝不符合CKFinder的最低系統(tǒng)要求。你的PHP版本太舊了。CKFinder 3.x需要PHP5.6+。有關(guān)更多詳細(xì)信息,請(qǐng)參閱CKFinder文檔。
下載放入項(xiàng)目相應(yīng)位置后,運(yùn)行代碼,Network中報(bào)錯(cuò):
{"error":{"number":500,"message":"The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file."} }原因:默認(rèn)情況下,CKFinder服務(wù)器連接器處于禁用狀態(tài)。
幫助文檔中提示:
????????By default, the CKFinder server connector is disabled. If you open the default CKFinder sample (located in /ckfinder/samples/full-page-open.html) you will see the following error message:
????????The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file.
????????In order to enable it, you should set the authentication function in config.php so that it returned true for users that should have access to CKFinder.
這段話的意思是:
? ? ? ? 在默認(rèn)情況下,CKFinder服務(wù)器連接器處于禁用狀態(tài)。如果打開默認(rèn)的CKFinder示例(位于/CKFinder/samples/full page open.html中),您將看到以下錯(cuò)誤消息:出于安全原因,已禁用文件瀏覽器。請(qǐng)聯(lián)系您的系統(tǒng)管理員并檢查CKFinder配置文件。為了啟用它,您應(yīng)該在config.php中設(shè)置身份驗(yàn)證函數(shù),以便對(duì)應(yīng)該有權(quán)訪問CKFinder的用戶返回true。
翻譯:出于安全原因,已禁用文件瀏覽器。請(qǐng)聯(lián)系您的系統(tǒng)管理員并檢查CKFinder配置文件。
解決方法:在配置文件中允許文件上傳,即開啟上傳權(quán)限。
文件位置:ckfinder\config.php
$config['authentication'] = function () {return true;};??最后,終于搞定了。
總結(jié)
以上是生活随笔為你收集整理的CKfinder3版本冲突的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 搭建网校平台的方式有哪些?
- 下一篇: 【Linux】Linux下文件名批量编号