gpt4 book ai didi

cakephp - 运行时异常 : Cake\Cache\Engine\FileEngine is not properly configured in CakePHP 3

转载 作者:行者123 更新时间:2023-12-01 11:22:56 25 4
gpt4 key购买 nike

我用 CakePHP 3.2 编写了一个应用程序,最近上传到专用服务器。

但是这给出了 RuntimeException 错误作为

Cache engine Cake\Cache\Engine\FileEngine is not properly configured.

Warning: file_put_contents(/var/www/html/logs/error.log) 
[function.file-put-contents]: failed to open stream: Permission denied in
/var/www/html/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 134

我尝试将 logstmp 目录的权限更改为 777(包括子目录),但这并没有解决问题。

ls -la 的输出

drwxr-xr-x. 13 root   root    4096 Oct 22 02:39 .
drwxr-xr-x. 4 root root 43 Oct 12 20:12 ..
drwxr-xr-x. 2 root root 63 Oct 21 15:08 bin
-rw----r--. 1 root root 1499 Oct 21 15:08 composer.json
-rw----r--. 1 root root 48701 Oct 21 15:08 composer.lock
drwxr-xr-x. 3 root root 4096 Oct 21 15:08 config
-rw----r--. 1 root root 329 Oct 21 15:08 .editorconfig
-rw----r--. 1 root root 772 Oct 21 15:08 .gitattributes
-rw----r--. 1 root root 41 Oct 21 15:08 .gitignore
-rw----r--. 1 root root 159 Oct 22 03:02 .htaccess
-rw----r--. 1 root root 648 Oct 21 15:08 index.php
-rw-r--r--. 1 apache apache 20 Oct 13 00:10 info.php
drwxrwxrwx. 2 root root 46 Oct 22 02:30 logs
drwxr-xr-x. 2 root root 10 Oct 21 15:08 mobile_scripts
-rw----r--. 1 root root 1202 Oct 21 15:08 phpunit.xml.dist
drwxr-xr-x. 3 root root 37 Oct 21 15:08 plugins
-rw----r--. 1 root root 1015 Oct 21 15:08 README.md
drwxr-xr-x. 8 root root 4096 Oct 21 15:13 src
drwxr-xr-x. 4 root root 71 Oct 21 15:13 tests
drwxrwxrwx. 6 root root 76 Oct 21 15:13 tmp
-rw----r--. 1 root root 321 Oct 21 15:08 .travis.yml
drwxr-xr-x. 21 root root 4096 Oct 21 15:14 vendor
drwxr-xr-x. 5 root root 4096 Oct 21 15:24 webroot

可能是什么原因以及如何解决?

最佳答案

我遇到了同样的问题。这可能是由于日志和 tmp 目录的权限。但有时,如果您的网络服务器用户与您的命令行用户不同,您可能会遇到此权限错误!

您可以在项目目录中运行这个小命令:

HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`  
setfacl -R -m u:${HTTPDUSER}:rwx tmp
setfacl -R -d -m u:${HTTPDUSER}:rwx tmp
setfacl -R -m u:${HTTPDUSER}:rwx logs
setfacl -R -d -m u:${HTTPDUSER}:rwx logs

它将正确设置权限!不要忘记重启 apache 服务:

service apache2 restart

如果你想检查这个:https://book.cakephp.org/3.0/en/installation.html

希望对你有帮助!! :D

关于cakephp - 运行时异常 : Cake\Cache\Engine\FileEngine is not properly configured in CakePHP 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40189099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com