Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read in a post at Server Fault that PHP-FPM needs execute permissions. However, the answer in When creating a website, what permissions and directory structure? only grants read and write permissions to PHP-FPM. Maybe I don't quite understand how PHP handlers (or CGI in general) work, but the two claims seem contradictory to me.

As I understand, when Apache / Nginx gets a request for foobar.php, it "passes" the file to an appropriate handler. That is, I imagine it's as if www-root (or apache or whomever the webserver's running as) were to run some command,

/usr/sbin/php-fpm foobar.php

Actually, no, that's naive, I just realized. PHP-FPM must be a running instance (if it's to be performant, and cache, etc.), so probably PHP-FPM is just being told, "Hey, quick, process this file for me!"

In either case, I don't see why execute permissions are necessary. It's not like the webserver needs to literally execute the file, i.e.


Is the Server Fault answer simply mistaken?

share|improve this question

No, php-fpm user does NOT need execute permissions on PHP files. It only needs read permission, as PHP files are parsed by PHP preprocessor and not executed directly.

share|improve this answer
Thanks! I take it however that some (if not all) CGI programs must be executable, e.g. Python scripts? Or is everything handled by such a "handler" that only needs read access. – Andrew Cheong Apr 28 '14 at 10:19

You are correct - the file does not need to be 755 executable. The file being passed to PHP-FPM should have permissions set to 644 (owner read/write, group read, global read). This is especially needed on shared hosting so that others can not overwrite your files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.