apache - Why can the same user make a directory on the command line but not via the webserver? -
i running apache on centos , in /etc/httpd/conf/httpd.conf file user , group both my-username
$ cat /etc/httpd/conf/httpd.conf|grep '^user' user my-username $ cat /etc/httpd/conf/httpd.conf|grep '^group' group my-username
when run my-username
on command line can create directory, not via call webserver.
$ cat test.php <?php mkdir(dirname(__file__) . '/made-by-the-webserver', 0755); $err = error_get_last(); $user = exec('whoami'); echo 'whie attempting create directory, got ' . $err['message'] . ' running ' . $user; $ curl mysite.local/test.php whie attempting create directory, got mkdir(): permission denied running my-username $ whoami my-username $ mkdir made-on-the-command-line $ ls -lah|grep made drwxrwxr-x. 2 my-username my-username 4.0k dec 16 14:51 made-on-the-command-line $ php test.php whie attempting create directory, got running my-username $ ls -lah|grep made drwxr-xr-x. 2 my-username my-username 4.0k dec 16 14:52 made-by-the-webserver drwxrwxr-x. 2 my-username my-username 4.0k dec 16 14:51 made-on-the-command-line
i expect that, because apache running user my-username
, , my-username
allowed create directories on command line, allowed create directories during call apache.
any in debugging appreciated, thanks!
albert.
almost due selinux. perhaps httpd_sys_script_rw_t property on parent directory needed?
Comments
Post a Comment