Enabling rss feeds on a vanilla forum that doesn’t allow public browsing

Friday, August 3rd, 2007

Situation

I recently installed the Vanilla forum and set it up so that it would not allow public browsing, because the discussions there are top secret ;)

I then installed the Feedpublisher extension to allow for RSS2 and ATOM feeds.

Problem

I encountered a major problem though, the rss feeds were not accessible because the forum did not allow public browsing. I also saw that on the vanilla community forum, this problem had been rasied, but no-one had offered a solution.
Also, when trying to access the feed through the browser, one gets an authentication pop up box requested a username and password. When one enters the username and password into the respective text fields the following error message is displayed:

A fatal, non-recoverable error has occurred
Technical information (for support personel):

Error Message
An error occurred while validating user credentials.
Affected Elements
Feed.ValidateCredentials();

The error occurred on or near: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(u.Password = md5('foobar') or u.Password = 'foobar' )' at line 1

Solution

After quite a bit of playing around and testing, I found a relatively easy solution to the problem – typical a five minute fix for an error that keeps you busy for 2 hours!!!

Step 1


So firstly go to /extensions/Feedpublisher/default.php and make sure that the following section of code looks like this (line 60-73 )

if ( $Context->Session->UserID == 0 && ! $Configuration[ "PUBLIC_BROWSING" ] )
{

// Temporarily make the PUBLIC_BROWSING enabled,
// but make sure to validate this user
$Configuration[ "PUBLIC_BROWSING" ] = 1;
$Context->Configuration[ 'AUTHENTICATE_USER_FOR_FEED_PUBLISHER' ] = 0;

}
else
{

$Context->Configuration[ 'AUTHENTICATE_USER_FOR_FEED_PUBLISHER' ] = 0;

}

Step 2

Then login to the admin section of the forum go to settings > categories > $category edit

Then you need to check the “unauthenticated�? option in the “Roles�? and hot save. Do this for each and every category, unless you don’t want a specific category to be displayed on the feed.

This method fixed my problem, so I would be interested to find out if anyone else has a better solution. Also let me know id it doesn’t work for you – I hope that’s not the case though.

How to turn off PHP safe mode and remove open_basedir restrictions to install the Seagull PHP framework on a Media Temple sub domain

Tuesday, April 3rd, 2007

Problem

I wanted to run an installation script on a sub-domain of a Dedicated-Virtual server hosted by Media Temple with a Plesk 7.5.4, but received the following php error message when I ran the script:

Warning: file_exists(): open_basedir restriction in effect.

Reason why the error occurs

The reason for this error is because, php safe mode is turned on and because the open_basedir is set for each sub-domain. After quite a lot of searching on the web, I eventually tried a few tutorials, but none of them were comprehensive enough to describe exactly how to solve the actual problem.

Solution

Follow these steps and you should solve the problem:

  1. SSH into your server using the root login information
  2. Once you have logged in, edit the php.ini file located /etc/ folder with a text editor. The line you are looking for is:
    a. Change this line safe_mode = on to safe_mode = off
    b. Or you can cut and paste this one-liner:
    perl -p -i -e ’s/^safe_mode\s*=\s*on/safe_mode = off/i;’ /etc/php.ini
  3. Make sure that the open_basedir in the php.ini file looks like this:

    ; open_basedir, if set, limits all file operations to the defined
    directory
    ; and below. This directive makes most sense if used in a per-
    directory
    ; or per-virtualhost web server configuration file. This directive is
    ; *NOT* affected by whether Safe Mode is turned On or Off.
    open_basedir = none

  4. Then you need to edit the virtual hosts for the domain and for each sub-domain in the http.inc file, which is located in the /var/www/vhosts/$domain/conf folder.
    Add the following section of code to the domain Virtual Host, as well as to each sub-domain Virtual Host


    < IfModule sapi_apache2.c >
    php_admin_flag engine on
    php_admin_flag safe_mode off
    php_admin_value open_basedir none
    < /IfModule >

    < IfModule mod_php5.c >
    php_admin_flag engine on
    php_admin_flag safe_mode off
    php_admin_value open_basedir none
    < /IfModule >

  5. To complete the process, one needs to type the following two commands:
  6. a. /etc/init.d/httpd stop
    b. /etc/init.d/httpd start

    Hit “Enter� after each command and you should be given an [ OK ] status in the command line.

    Conclusion

    This should solve your problem and if you have any comments, suggestions or improvements, please submit them.