Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Problem Installing Vanilla 2.3 (in SE Linux) [RESOLVED]

jm109344jm109344 New
edited April 2017 in Vanilla 2.0 - 2.8

I'm trying to test Vanilla but can't seem to get past the setup. I created a 'forums' folder in my http root directory, I also chmod'd the cache & conf directory, but when I go to http://[my server ip]/forums I get a message stating that "These folders must be readable and writable by the web server:" and it lists

  • /var/www/html/forums/conf
  • /var/www/html/forums/cache
  • /var/www/html/forums/cache/Smarty/compile

I have verified that they are all readable and writable

bash-4.2$ ls -l /var/www/html/forums
total 80
drwxrwxrwx. 5 root root 56 Nov 18 10:44 applications
-rw-rw-rw-. 1 root root 7907 Nov 18 10:44 bootstrap.php
drwxrwxrwx. 3 root root 34 Nov 18 10:44 cache
drwxrwxrwx. 2 root root 86 Apr 25 15:28 conf

...

bash-4.2$ ls -l /var/www/html/forums/cache/
total 0
drwxrwxrwx. 3 root root 35 Nov 18 10:44 Smarty
bash-4.2$ ls -l /var/www/html/forums/cache/Smarty/
total 0
drwxrwxrwx. 2 root root 21 Nov 18 10:44 compile

I did have to create a config.php file with the following contents:

<?php
$Configuration['Debug'] = TRUE;
$Configuration['Garden']['RewriteUrls'] = false;

Without the 'RewriteUrls' the web server wasn't able to locate the directories and I added 'Debug' to see if I could get any additional information on the problem, but don't see anything. I also replaced the default .htaccess with the one from 2.2 (as suggested in several posts I've read).

Config
CentOS 7.3.1611
Apache 2.4.6
PHP 7.1.4 (phpMyAdmin works & a basic phpinfo.php in the 'forums' directory works).

Appreciate any ideas or thoughts you may have

Best Answer

Answers

  • R_JR_J Admin
    1. I wouldn't set the folders permissions to 777. Instead change the owner to the web user (www-data?) and you should be fine with 755 for the permissions afterwards.
    2. Don't create a config.php manually. I see why you did that, but I don't know if that may be "confusing". Instead add those lines to the config-defaults.php for the time of the installation and remove them after the forum has successfully been installed
    3. Search the .htaccess for # RewriteBase / and change it to RewriteBase /forums
  • jm109344jm109344 New
    edited April 2017

    1 - It is a test machine so I wasn't concerned about these settings, however; I made the changes you suggested - no difference
    2 - I went to modify config-default.php but it has the "DO NOT EDIT" at the top, so I created config.php. I went ahead and deleted config.php and placed those options in the default file - no difference
    3 - I already had RewriteBase in the .htaccess file (see below).

    Any other thoughts?

    HTACCESS file:

    Original

    If you modify this file then change the above line to: # Modified

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # Certain hosts may require the following line.
    # If vanilla is in a subfolder then you need to specify it after the /.
    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
    RewriteBase /forums
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>

  • R_JR_J Admin

    The main problem is the false read/write permission message. I would try to focus on that first and delete the complete folder contents and re-upload all files (or get the zip with wget and unzip it on the server)

  • @jm109344
    Hi,
    you tried to install vanilla with htaccess version 2.2.1 ?

  • @R_J I completely removed the forums directory, used wget to get the vanilla zip, unzip it. I chown -R apache forums, and chmod -R 777 forums but I still ended up with the same issue.

    I went ahead and added:

    ini_set('display_errors',1);
    error_reporting(E_ALL);

    to config-defaults.php, when I do this I get the following

    fopen(/var/www/html/forums/conf/8827847255901046faeb24.tmp): failed to open stream: Permission denied

    but if I do the following manually the file is created properly (I have also confirmed that my apache server is using the 'apache' user)

    [root@localhost forums]# su apache -s /bin/sh -c 'echo Hello > /var/www/html/forums/conf/8827847255901046faeb24.tmp' [root@localhost forums]# su apache -s /bin/sh -c 'cat /var/www/html/forums/conf/8827847255901046faeb24.tmp' Hello

    Just as a test i modified 'library/core/functions.general.php" and added a bunch of print statements to the 'isWritable' function to see if I could get more information. The interesting thing is that the 'fopen' call fails for both the 'conf' and 'cache' directory but succeeds for the 'uploads' directory. As best as I can tell these 3 directories are configured identically

    drwxrwxrwx. 3 apache root 49 Apr 26 15:54 cache drwxrwxrwx. 2 apache root 4096 Apr 26 16:43 conf drwxrwxrwx. 2 apache root 21 Apr 26 16:43 uploads

    The only difference I can see is that uploads is an empty directory, cache has the 'Smarty' directory and conf has the configuration files.

    Apache is being run as a daemon (sudo systemctl start httpd), I'm a bit rusty on my Linix but is it possible when that process is running it has restricted access for some reason, e.g. selinux (even though it owns the directory and files)? I will have to investigate this further if you don't know off the top of your head.

    @kopana Do you think the .htaccess file would cause this issue? If you can point me to a 2.2.1 version I'll give it a try (I'll try find it myself in the mean time)

    Thanks for all the great input, you've been very supportive.
    Jim

  • @jm109344

    @kopana Do you think the .htaccess file would cause this issue? If you can point me to a 2.2.1 version I'll give it a try (I'll try find it myself in the mean time)

    Vanilla 2.2.1 Change the file .htaccess before installing Vanilla.

  • It was SELinux causing the problem, looking at the auditlog and running "audit2allow -w -a" provided the information on fixing it. I actually just set SELinux to be permissive instead of enforcing (the machine doesn't have internet access).

    Thanks

  • @jm109344

    Thanks for getting back to report the resolution.

    I've edited the title of the thread a bit to try to reflect the issue a bit more clearly. (If the change doesn't do that, could you let me know what would be better?)

Sign In or Register to comment.