问题描述
我已经按照以下步骤安装了 CakePHP 2.0 框架:
I have installed CakePHP 2.0 framwork using steps below:
1. Start the terminal
2. sudo mkdir /var/www/cakephp
3.sudo cp -r ~/cakephp/* /var/www/cakephp
更改 tmp 文件夹权限
Change tmp folder permisssion
4. sudo chmod -R 777 cakephp/app/tmp
启用模组重写
5. sudo a2enmod rewrite
打开文件/etc/apache2/sites-enabled/000-default 并将 AllowOverride None
更改为 AllowOverride All
Open file /etc/apache2/sites-enabled/000-default and change AllowOverride None
to AllowOverride All
6. sudo vim /etc/apache2/sites-enabled/000-default
重启阿帕奇
7. sudo /etc/init.d/apache2 restart
我打开浏览器并输入地址 http://localhost/cakephp/ 并看到此错误消息:
I opened my browser and typed address http://localhost/cakephp/ and I seaw this error message:
警告:_cake_core_ 缓存无法将cake_dev_en-us"写入/var/www 中的文件缓存/cakephp/lib/Cake/Cache/Cache.php on line 310
警告:_cake_core_ 缓存无法在第 310 行将cake_dev_en-us"写入/var/www/cakephp/lib/Cake/Cache/Cache.php 中的文件缓存
警告:/var/www/cakephp/app/tmp/cache/persistent/在/var/www/cakephp 中不可写/lib/Cake/Cache/Engine/FileEngine.php on line 320
警告:/var/www/cakephp/app/tmp/cache/models/在第 320 行的/var/www/cakephp/lib/Cake/Cache/Engine/FileEngine.php 中不可写
警告:/var/www/cakephp/app/tmp/cache/在/var/www/cakephp/lib/Cake 中不可写/Cache/Engine/FileEngine.php 第 320 行
推荐答案
命令 sudo chmod -R 777 cakephp/app/tmp
只使 tmp
可写,你应该使缓存及其子目录也可写,否则Cake无法将缓存文件写入tmp中的缓存目录.
The command sudo chmod -R 777 cakephp/app/tmp
only made tmp
writable, you should make cache and it's subdirectories writable as well, otherwise Cake can't write the cache files to the cache directory in tmp.
所以,这些目录应该是可写的:
So, these directories should be writable:
cakephp/app/tmp/cache
cakephp/app/tmp/cache/persistent
cakephp/app/tmp/cache/models
确保日志目录也是可写的:cakephp/app/tmp/logs
.
Make sure the log directory is writable as well: cakephp/app/tmp/logs
.
这篇关于在 Ubuntu 10.4 中运行 CakePHP 时遇到文件权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!