0

I am trouble setting up cakephp-2.5.2 on a nginx server. I have been looking at questions on this site and else where that are similar, but the answers don't seem that good. I can't use url rewriting, because I don't own the server, so I don't have permission to mess with those files, but files under cake I could change. Anyway, I am getting these errors:

Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /home/webdev/webroot/cake/lib/Cake/Cache/Cache.php on line 323

Warning: /home/webdev/webroot/cake/app/tmp/cache/persistent/ is not writable in /home/webdev/webroot/cake/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 /home/webdev/webroot/cake/lib/Cake/Cache/Cache.php:181 Stack trace: #0 /home/webdev/webroot/cake/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #1 /home/webdev/webroot/cake/app/Config/core.php(373): Cache::config('_cake_core_', Array) #2 /home/webdev/webroot/cake/lib/Cake/Core/Configure.php(72): include('/home/webdev/we...') #3 /home/webdev/webroot/cake/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) #4 /home/webdev/webroot/cake/app/webroot/index.php(94): include('/home/webdev/we...') #5 /home/webdev/webroot/cake/index.php(41): require('/home/webdev/we...') #6 {main} thrown in /home/webdev/webroot/cake/lib/Cake/Cache/Cache.php on line 181

After some searching I made /home/webdev/webroot/cake/app, /home/webdev/webroot/cake/app/tmp, /home/webdev/webroot/cake/app/tmp/cache and /home/webdev/webroot/cake/app/tmp/cache/persistent and /home/webdev/webroot/cake/app/tmp/logs all have permissions 775 (or rwxrwxr-x), but I am still getting these erros

I am not sure if there is something I can change in cake/.htaccess, cake/app/.htaccess, or cake/app/webdev/.htaccess files, or to cake/app/webroot/index.php or some other files

Any help would be much appreciated. Thankyou

user221931
  • 1,852
  • 1
  • 13
  • 16
user1296259
  • 521
  • 1
  • 13
  • 33

1 Answers1

1

Nginx doesn't use .htaccess so don't bother with it.

Your problem is permissions as the message suggests.

Setting 775 is useless if the web service user is not the same or not in the same group as the one the files belong to. In that case permission 5 will apply (for "world") which doesn't give access to execute (=enter) the tmp directory and read/write.

The quickest would be to chmod 777 tmp -R, the best would be to chown tmp recursively to the web service group (and perhaps clear the cache as good measure).

user221931
  • 1,852
  • 1
  • 13
  • 16
  • Don't add the user to the web service group, do it the other way around: add the web service user to the user's group, this way the web service group can read the user's files (providing the proper group permissions), and the user can't read anything the web service owns. Also consider, if the user belongs to the web service group, then they can read everybody else's files too - which is not good in a shared env. – zamnuts Jul 09 '14 at 21:58
  • You're right @zamnuts. On second thought, if someone would be able to add themselves or the webservice to any user/group they'd most probably have enough access to "mess with nginx configuration" which the user mentions he can't. So I remove that suggestion from my answer for both reasons. – user221931 Jul 10 '14 at 01:11