MyBB Community Forums

Full Version: installation doesn't see file permissions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am trying to install the latest mybb-1.6.11. I have root access to my Fedora 19 box.

# cat /etc/redhat-release
Fedora release 19 (Schrödinger’s Cat)

# rpm -q mariadb nginx php-fpm
mariadb-5.5.33a-1.fc19.x86_64
nginx-1.4.4-1.fc19.x86_64
php-fpm-5.5.7-1.fc19.x86_64

I followed the installation instructions, including adding write permissions to the appropriate files

# ls -ld uploads/ uploads/avatars/ cache/ cache/themes/ inc/settings.php inc/config.php
drwxrwxrwx. 3 root root 4096 Apr 10 2013 cache/
drwxrwxrwx. 2 root root 4096 Apr 10 2013 cache/themes/
-rw-rw-rw-. 1 root root 0 May 8 2012 inc/config.php
-rw-rw-rw-. 1 root root 0 May 8 2012 inc/settings.php
drwxrwxrwx. 3 root root 4096 Apr 10 2013 uploads/
drwxrwxrwx. 2 root root 4096 Apr 10 2013 uploads/avatars/

But the installation setup of mybb doesn't see this. It gives me the error

----------------------------
Error
The MyBB Requirements check failed due to the reasons below. MyBB installation cannot continue because you did not meet the MyBB requirements. Please correct the errors below and try again:

The configuration file (inc/config.php) is not writable. Please adjust the chmod permissions to allow it to be written to.

The settings file (inc/settings.php) is not writable. Please adjust the chmod permissions to allow it to be written to.

The cache directory (cache/) is not writable. Please adjust the chmod permissions to allow it to be written to.

The uploads directory (uploads/) is not writable. Please adjust the chmod permissions to allow it to be written to.

The avatars directory (uploads/avatars/) is not writable. Please adjust the chmod permissions to allow it to be written to.
--------------------------------------

You are welcome to check this at

http://wd369.memphis.edu/forums/install

To get my php info, please see

http://wd369.memphis.edu/info.php

Where should I look for problems?
Try chowning the directory where MyBB is installed.

chown -Rv apache:apache /usr/share/nginx/html/wd369.memphis.edu/forums/

I've always had to do this when installing MyBB directly on to a box.
Thanks. Didn't work. I even tried with nginx owner. I have mybb set up on an ubuntu box, and there is no problem with root owning the top directory.

I have no idea how the mybb installation checks these permissions, but there is no problem with writing to those directories and files as a non-root user. Mabbe a php bug on Fedora?

OK, so I think the problem is with fast-cgi, but hopefully somebody will help me to figure this out.

So I create, emulating what the mybb install scripts are doing, the file test_wperm.php

# cat test_wperm.php
<?php
define('MYBB_ROOT', dirname(__FILE__)."/");
#echo MYBB_ROOT;
$configwritable = @fopen(MYBB_ROOT.'try.txt', 'w');

if(!$configwritable)
{
echo "not writable";
}
else
{
echo "writable";
}
@fclose($configwritable);

?>

Then I do

# touch try.txt && chmod a+w try.txt

When I open the php script file in the browser as

http://wd369.memphis.edu/forums/test_wperm.php

I get "not writable". Ouch. On the other hand, in the shell I get

# php -f test_wperm.php
writable

So the problem must be with how the script gets executed by the nginx server, hence, I suppose, with php-fpm.

On my ubuntu box, all is fine.
The problem was that I needed to modify the selinux configuration appropriately. For others encountering the same problem: if selinux is enforced, you need to do (single line command)

chcon -t httpd_sys_rw_content_t cache cache/themes uploads uploads/avatars admin/backups inc/config.php inc/settings.php inc/languages/english/*.php inc/languages/english/admin/*.php