由于开发中需要搭建本地环境,在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的存在
希望能够帮到存在同样问题的你!