6

I have been developing an app in FatFree framework and now I am trying to deploy it on a server. Everything seems to be fine when I am running it on localhost.

However, when I have deployed it on the server and trying to access it, it gives me a strange error which is -

Internal Server Error

chmod(): Operation not permitted

#0 /var/www/webapp/inc/main.php:62 Template::serve('front_page.php')
#1 /var/www/index.php:65 F3::run()

I have given 777 permissions to the webapp folder so chmod() should be allowed. The above suggests that there is an error while serving the template file front_page.php.

How can I fix this?

jpic
  • 32,891
  • 5
  • 112
  • 113
Siddharth
  • 5,009
  • 11
  • 49
  • 71
  • Yes. Actually it was that the parent directory did not permissions. It makes a temp directory which it was unable to do. – Siddharth Mar 19 '12 at 11:30
  • where is `'front_page.php'` located? And did the `webapp` folder permission of 777 cascade down to the `inc` folder? – redDevil Mar 19 '12 at 11:42
  • 1
    777 is very bad practice for a webapp. you should do 755. –  Mar 19 '12 at 11:54

4 Answers4

7

For this you have to give the permissions recursively using -R for your "webapp" folder

Learner
  • 714
  • 1
  • 5
  • 24
5

Siddharth alludes to the correct answer in the comments:

F3 compiles templates to a temp/ dir before serving. This temp dir needs to a) exist and b) have appropriate permissions.

To achieve this, go the dir where your template file exists and run:

mkdir temp/
chown www-data temp
lubar
  • 2,589
  • 2
  • 26
  • 28
  • 1
    Yes. But if your parent directory has write permissions by www-data then it will automatically make the temp/ directory. You do not have to make it yourself. – Siddharth Nov 19 '12 at 06:07
2

You can add write permissions for web-server to your [fatfree-web-root-dir]. Not safe!

chmod  o+w  fatfree-web-root-dir  # Then web-server can create "temp" folder.

An other way: You must create "temp" directory with web-server owner:

mkdir  fatfree-web-root-dir/temp
chown  www-data:www-data  fatfree-web-root-dir/temp
# www-data - in Debian for example
user79382
  • 61
  • 4
2

Check intermediary directories permissions It's a common gotcha.

jpic
  • 32,891
  • 5
  • 112
  • 113