CakePHP的部署遇到的 'CacheException' 報錯問題

由於開發中需要搭建本地環境,在windows用vmware搭建了一個基於centos7.3的LAMP環境。
當將cakephp開發框架部署到html目錄後,運行就直接報錯了。

報錯代碼如下:

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. 
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. 
We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.in /var/www/html/cakephp/lib/Cake/Cache/CacheEngine.php on line 60
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www/html/cakephp/lib/Cake/Cache/Cache.php on line 323
Warning: /var/www/html/cakephp/app/tmp/cache/persistent/ is not writable in /var/www/html/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 384
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /var/www/html/cakephp/lib/Cake/Cache/Cache.php:181 Stack trace: #0 /var/www/html/cakephp/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #1 

看這段報錯提示大概的意思就是我cache目錄下的相關文件夾沒有寫入權限,但實際上我也不是第一次開車了,給相應的權限我還不知道?那問題出在哪呢?
後來我才發現是selinux的問題!
首先我們需要檢查一下selinux是否開啓
鍵入命令:

/usr/sbin/sestatus -v   

如果SELinux status參數爲enabled即爲開啓狀態
開啓了那就關閉它!

vi /etc/selinux/config   

SELINUX=enforcing  

改爲

SELINUX=disabled

ok,wq保存退出
接着重啓服務器

shutdown -r now

接下來就不會報錯了,並且能夠看到歡迎頁面了
由於自己的疏忽,忘了selinux的存在,導致本人在公司睡了兩個晚上才解決了問題
希望能夠幫到存在同樣問題的你!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章