1

After moving php-files from windows to linux(centos) I started getting the following permissions errors:

ERRNO: 2
TEXT: rename(/tmp/wrtwetuti,/var/www/site1/presentation//compile_dir/ee63ba1108c61f830b5d6155f21b1bcd04684f7e.file.category.tpl.php): Permission denied
LOCATION: /var/www/site1/libs/smarty_3/sysplugins/smarty_internal_write_file.php, line 48, at September 9, 2011, 4:05 am

When for testing purposes chmoded compile_dir to 777, the problem goes away.

I wonder if anybody knows a solutions for it. Would installing suPHP solve this problem?

Evgeny Tryastsin
  • 723
  • 2
  • 10
  • 19

2 Answers2

3

compile_dir is supposed to be writable by the web server (and also outside your web root). So you should:

  • move it out of your web root
  • assign ownership to the web server user
  • chmod it to 700

The fact that on your Windows install the default compile_dir was also writable by the web server is typical for that OS, and doesn't mean that there is something to fix on Linux.

Jon
  • 428,835
  • 81
  • 738
  • 806
  • why would I need to move it out of web root? – Evgeny Tryastsin Sep 09 '11 at 13:22
  • @Eugene: On principle, because the documentation recommends it. As a practical matter, because if you do not then unless your web server is specifically configured to forbid it anyone on the internet might be able to get hold of your compiled Smarty templates. This would allow them to learn things about your code that you might not want them to know. – Jon Sep 09 '11 at 13:25
  • Thank you! So moving compile_dir from /var/www/site1/presentation/compile_dir/ to say /var/compile_dir/ would do? – Evgeny Tryastsin Sep 09 '11 at 13:37
  • @Jon, could you kindly explain how to find out the "web server user" name? Or how to "assign ownership to the web server user" – klm123 May 01 '14 at 15:21
  • @klm123: Assuming Linux, for the web server user name: http://stackoverflow.com/q/7771586/50079. To change ownership: `sudo chown new_owner compile_dir`. Standard stuff. – Jon May 01 '14 at 15:56
2

You can look at this page: http://www.smarty.net/docs/en/installing.smarty.basic.tpl "Smarty will need write access (windows users please ignore) to the $compile_dir and $cache_dir directories (templates_c/ and cache/), so be sure the web server user account can write to them".

hope this helps.

John Smith
  • 808
  • 3
  • 9
  • 20