0

I have a server set up on AWS and i ahve deployed my application to it, like i have done many time to other servers. After turning core.php debug to 2, the following error showed

Warning: /var/www/html/XXX/XXX/app/tmp/cache/persistent/ is not writable in /var/www/html/XXX/XXX/lib/Cake/Cache/Engine/FileEngine.php on line 389

This is a common warning i recieve any time i pull down the code from git.

As usual i run

chmod -R 777 tmp

And I still recieve the warning, which doesnt let me proceed until i fix it!

I have tried to rename the tmp folder

mv tmp tmp1

and i get this

mkdir(): Permission denied in /var/www/html/XXX/XXX/lib/Cake/Cache/Engine/FileEngine.php on line 384

Which is the warning that shows when you dont have a tmp folder in your app folder.

I have tried to changed the folder user group to apache:apache too and still no luck.

The error logs show nothing apart from the ones i get when i refresh the page.

Pooshonk
  • 1,284
  • 2
  • 22
  • 49
  • 1
    Can you configure it to use a temp directory outside of the web root? It seems to be a bad place to allow writing to anyway. If someone found the path they could upload malicious PHP code and be able to run it. – MER Jul 17 '19 at 14:08

3 Answers3

0

change owner of the directory .

for example
  chown nginx:nginx ../tmp
  chown apache:apache ../tmp
mahendra rathod
  • 1,438
  • 2
  • 15
  • 23
0

Found out what was the problem. SELinux was set to enforcing

/etc/selinux/config

Set it to permissive and it works fine now

Pooshonk
  • 1,284
  • 2
  • 22
  • 49
  • hmm...SELinux was blocking that for a reason. It's dangerous to allow writing to directories under the web root. – MER Jul 17 '19 at 14:46
0

Follow the Installation Guide of CakePHP

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
VLDCNDN
  • 692
  • 1
  • 7
  • 19