title: Impossible to write on file in php with nginx + php-fpm
body: <p>I can't understand why a php function is_writable() returning always false.
  I see nothing in the log about it, and after searching for hours : I can't understand why.</p>
  
  <p>File setup :</p>
  
  <pre><code>[root@localhost owncloud]# ls -la /etc/test
  -rwxrwxrwx. 1 nginx nginx 4 Jul 31 17:41 /etc/test
  </code></pre>
  
  <p>test.php</p>
  
  <pre><code>&lt;?php
      $filename = '/etc/test';
      echo exec('whoami');
      if (file_exists($filename)) {
          echo 'Exist';
      } else {
          echo 'NOT exist';
      }
      if (is_writable($filename)) {
          echo 'writable';
      } else {
          echo 'NOT writable';
      }
  ?&gt;
  </code></pre>
  
  <p>it returns :</p>
  
  <pre><code>nginx
  Exist
  NOT writable 
  </code></pre>
  
  <p>My nginx has the following configuration :</p>
  
  <p>/etc/nginx/nginx.conf</p>
  
  <pre><code>user  nginx;
  worker_processes  1;
  
  error_log  /var/log/nginx/error.log;
  #error_log  /var/log/nginx/error.log  notice;
  #error_log  /var/log/nginx/error.log  info;
  
  pid        /run/nginx.pid;
  
  events {
      worker_connections  1024;
  }
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
  
      access_log  /var/log/nginx/access.log  main;
      sendfile        on;
      keepalive_timeout  65;
  
     server {
  
      listen 8080 ssl;
      ssl_certificate     /etc/nginx/certs/owncloud.crt;
      ssl_certificate_key /etc/nginx/certs/owncloud.key;
  
      error_log /var/log/nginx/owncloud.log;
      access_log /var/log/nginx/owncloud.log;
  
      server_name owncloud;
  
      root /var/www/owncloud;
  
      client_max_body_size 10G; # set max upload size
      fastcgi_buffers 64 4K;
  
      rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
      rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
      rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
  
      index index.php;
      error_page 403 = /core/templates/403.php;
      error_page 404 = /core/templates/404.php;
  
      location = /robots.txt {
          allow all;
          log_not_found off;
          access_log off;
      }
  
      location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
          #allow instead of deny for testing purpose    
              allow all;
      }
  
      location / {
              rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
              rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
              rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
              rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
              rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
  
              try_files $uri $uri/ index.php;
      }
  
      location ~ ^(.+?\.php)(/.*)?$ {
              try_files $1 = 404;
  
              include fastcgi_params;
              fastcgi_param SCRIPT_FILENAME $document_root$1;
              fastcgi_param PATH_INFO $2;
              fastcgi_param HTTPS on;
              fastcgi_pass 127.0.0.1:9000;
      }
    }
  }
  </code></pre>
  
  <p>/etc/php-fpm.conf</p>
  
  <pre><code>include=/etc/php-fpm.d/www.conf
  [global]
  pid = /run/php-fpm/php-fpm.pid
  error_log = /var/log/php-fpm/error.log
  log_level = debug
  daemonize = no
  </code></pre>
  
  <p>/etc/php-fpm.d/www.conf</p>
  
  <pre><code>[www]
  listen = 127.0.0.1:9000
  listen.allowed_clients = 127.0.0.1
  listen.owner = nginx 
  listen.group = nginx
  user = nginx
  group = nginx
  pm = dynamic
  pm.max_children = 50
  pm.start_servers = 5
  pm.min_spare_servers = 5
  pm.max_spare_servers = 35
  slowlog = /var/log/php-fpm/www-slow.log
  php_admin_value[error_log] = /var/log/php-fpm/www-error.log
  php_admin_flag[log_errors] = on
  php_value[session.save_handler] = files
  php_value[session.save_path] = /var/lib/php/session
  </code></pre>