Permission Denied on mkdir php with nginx
<p>I am struggling with an issue on LEMP stack. I cannot make my nginx user to create directory via php script.</p>

<p>My stack is 
RHEL 7.2
NGINX
MariadB
PHP</p>

<p>I installed the stack successfully and used following code for creating directory in index.php</p>

<pre><code>        &lt;?php
           echo(exec("whoami"));
           mkdir("test",0777,true);
           $error=error_get_last();
           echo $error['mssage'];
        ?&gt;
</code></pre>

<p>Output 
               nginx
               mkdir(): Permission denied</p>

<p>Nginx excecutes <code>PHP</code> via <code>nginx</code> user.</p>

<pre><code>Applied 'chown -R nginx: nginx &lt;working folder&gt;'
Applied 'chmod -R 0777 &lt;working folder&gt;
</code></pre>

<p>But above script gives same permission denied error.</p>

<p>My plan is to install Wordpress and import sites to this web server. But since permission is denied on working folder of nginx , Wordpress is not able to create new directories or move content from one folder to other.</p>