Hide Forgot
Created attachment 840188 [details] test write permission via php Description of problem: php doesn't recognize write permission of a file. This happens only when it's run via a webserver (nginx). This is why I am assuming, the bug is in the php-fpm package. Version-Release number of selected component (if applicable): $ rpm -q nginx php-fpm php nginx-1.4.4-1.fc19.x86_64 php-fpm-5.5.7-1.fc19.x86_64 php-5.5.7-1.fc19.x86_64 How reproducible: always Steps to Reproduce: 1. You need to have php, nginx (or probably any other web server set up to run php-fpm) 2) cd to a directory which is serverd by the webserver. $ cd /usr/share/nginx/html/wd369.memphis.edu 3) Create the attached php file (prolly you have to be root) $ cat test_wperm.php <?php define('MYBB_ROOT', dirname(__FILE__)."/"); $configwritable = @fopen(MYBB_ROOT.'try.txt', 'w'); if(!$configwritable) { echo "not writable"; } else { echo "writable"; } @fclose($configwritable); ?> 4) Create the writable file try.txt $ touch try.txt && chmod 666 try.txt 5) Run the test program through php # php -f test_wperm.php writable 6) Now open test_wperm.php in your browser via the webserver. In my case http://wd369.memphis.edu/test_wperm.php I get the output in my browser not writable Additional remarks: 1) I noticed the bug when trying to install the Simple Machines and the Mybb forum softwares. For me the bug is serious since these programs failed to install because of this problem while on my ubuntu box, they install fine. 2) My nginx config for php-fpm is # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; #try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/wd369.memphis. edu$fastcgi_script_name; include fastcgi_params; }
Unfortunately, nginx might also be at fault: on my ubuntu box, I have an older version, 1.4.1. Recall, that this version works fine with php.
Please check SElinux context. With SELinux ON, you need to set writable file context to httpd_sys_rw_content_t.
That's exactly what the problem was. Thanks.