Do PHP-FPM (and other PHP handlers) need execute permissions on the PHP files they're serving?

Posted by Andrew Cheong on Pro Webmasters See other posts from Pro Webmasters or by Andrew Cheong
Published on 2014-04-28T03:47:39Z Indexed on 2014/06/07 3:48 UTC
Read the original article Hit count: 283

Filed under:
|
|

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.

./foobar.php

Is the Server Fault answer simply mistaken?

© Pro Webmasters or respective owner

Related posts about php

Related posts about apache