Topic: Installing on SourceForge

I'm going to install punbb on SourceForge.net but due to it's no-write-access-from-the-webserver policy the cache file is rendered useless and installation becomes a bit harder.

Can I have some help on getting it up and running easily?

BTW I know about http://www.punbb-hosting.com/ and may try it but for now I'm using SF.net (the no-write thing for its webspace DOES add a nice level of security which we need).

Re: Installing on SourceForge

Actually, PunBB should work fine without cache: this will just increase the server load, but forum will keep working. (I hope so :-))

Carpe diem

Re: Installing on SourceForge

theforkofjustice wrote:

BTW I know about http://www.punbb-hosting.com/ and may try it but for now I'm using SF.net (the no-write thing for its webspace DOES add a nice level of security which we need).

That service uses FluxBB wink

FluxBB - v1.4.8

Re: Installing on SourceForge

Anatoly wrote:

Actually, PunBB should work fine without cache: this will just increase the server load, but forum will keep working. (I hope so :-))

I installed 1.3 (might as well go with the newest version)

It worked well until it sent me the config.php file.  I uploaded it to the forum's root directory as instructed and went to the forum's URL to see if it was up and running but it gave me an error.

An error was encountered

Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory 'cache'.

The error occurred on line 45 in /home/groups/l/li/linuxforclinics/htdocs/forum/include/cache.php

Line 45 states:

error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'.', __FILE__, __LINE__);

So it is obviously trying to write to the cache directory but can't due to the write restrictions.

I keep hearing about bypassing the cache but how is it done? It's exactly what I need.

Re: Installing on SourceForge

I was wrong. You are right. smile

Try this:

1. Create empty files for each cache file: e.g. /cache/cache_config.php. Just empty files doing nothing. Forum will include them (errors will be avoided), but the constants will not be defined and cache file regeneration will start then.

2. Modify each cache function in cache.php so that before $fh = @fopen... it set proper variable in the global scope.

E.g. replace

// Output config as PHP code
$fh = @fopen(FORUM_CACHE_DIR.'cache_config.php', 'wb');
if (!$fh)
    error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'.', __FILE__, __LINE__);
    fwrite($fh, '<?php'."\n\n".'define(\'FORUM_CONFIG_LOADED\', 1);'."\n\n".'$forum_config = '.var_export($output, true).';'."\n\n".'?>');

with

$GLOBALS['forum_config'] = $output;

Do not define the constant (e.g. FORUM_CONFIG_LOADED).

Looks like that's all. Though that is just a solution from head.
We'll consider the creation of pun_disable_cache extension.
Please, report your results smile

Carpe diem

Re: Installing on SourceForge

Okay, I'll give that a shot.  I tried installing punbb 1.3 on my own system (Ubuntu) and GOT THE SAME ERROR!  Seems it needs permissions on the cache folder to be at 0777.

A solution to this problem would be for the software to send you the files it was going to write to the cache directory (perhaps all in one tar.gz file) much like the original cache.php that it sends you to upload to the forum's root directory.  That way you can upload them to the cache directory yourself (though I'm not certain how the cache works I think this would be a nice alternative).

7 (edited by theforkofjustice 2008-11-10 17:49)

Re: Installing on SourceForge

So, to summarize:  I open the file /include/cache.php and replace every instance of

$fh = @fopen...

fclose($fh);

with just

$GLOBALS['forum_config'] = $output;

or do I just replace the function's values like so:

$fh = @fopen($GLOBALS['forum_config'] = $output;);

and upload empty versions of these files into /cache:

cache_bans.php
cache_censors.php
cache_config.php
cache_ext_version_notifications.php
cache_forum.php
cache_hooks.php
cache_quickjump.php
cache_ranks.php
cache_updates.php

Is that all?

Re: Installing on SourceForge

theforkofjustice wrote:

So, to summarize:  I open the file /include/cache.php and

1. replace every instance of

$fh = @fopen...

fclose($fh);

with just

$GLOBALS['forum_config'] = $output;

2. or do I just replace the function's values like so:

$fh = @fopen($GLOBALS['forum_config'] = $output;);

3. and upload empty versions of these files into /cache:

4. Is that all?

1. Yes.
2. No.
3. Yes.
4. Hope so smile

More about 1-st point: you need smart replace.
Look at

fwrite($fh, '<?php'."\n\n".'define(\'FORUM_CONFIG_LOADED\', 1);'."\n\n".'$forum_config = '.var_export($output, true).';'."\n\n".'?>');
fwrite($fh, '<?php'."\n\n".'define(\'FORUM_BANS_LOADED\', 1);'."\n\n".'$forum_bans = '.var_export($output, true).';'."\n\n".'?>');

Note the variable before var_export() call. The idea is that you should virtually include the files, i.e. initialize the proper variables. Each cache creates its' variable. You should use that name for $GLOBAL['cache variable name here'].
For the codes above this will be:

$GLOBALS['forum_config'] = $output;
$GLOBALS['forum_bans'] = $output;
Carpe diem

Re: Installing on SourceForge

*sigh* New Error

An error was encountered

There is no valid language pack '' installed. Please reinstall a language of that name.

Not certain what I did to get this message.

Also, when editing the cache_quickjump section of /include/cache.php I only replaced

$fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb');
        if (!$fh)
            error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'.', __FILE__, __LINE__);

        $output = '<?php'."\n\n".'if (!defined(\'FORUM\')) exit;'."\n".'define(\'FORUM_QJ_LOADED\', 1);'."\n".'$forum_id = isset($forum_id) ? $forum_id : 0;'."\n\n".'?>';
        $output .= '<form id="qjump" method="get" accept-charset="utf-8" action="'.$base_url.'/viewforum.php">'."\n\t".'<div class="frm-fld frm-select">'."\n\t\t".'<label for="qjump-select"><span><?php echo $lang_common[\'Jump to\'] ?>'.'</span></label><br />'."\n\t\t".'<span class="frm-input"><select id="qjump-select" name="id">'."\n";

with

$GLOBALS['forum_config'] = $output;

Was I correct in doing so or do I have to replace all of this:

foreach ($groups as $group_id)
    {
        // Output quickjump as PHP code
        $fh = @fopen(FORUM_CACHE_DIR.'cache_quickjump_'.$group_id.'.php', 'wb');
        if (!$fh)
            error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'.', __FILE__, __LINE__);

        $output = '<?php'."\n\n".'if (!defined(\'FORUM\')) exit;'."\n".'define(\'FORUM_QJ_LOADED\', 1);'."\n".'$forum_id = isset($forum_id) ? $forum_id : 0;'."\n\n".'?>';
        $output .= '<form id="qjump" method="get" accept-charset="utf-8" action="'.$base_url.'/viewforum.php">'."\n\t".'<div class="frm-fld frm-select">'."\n\t\t".'<label for="qjump-select"><span><?php echo $lang_common[\'Jump to\'] ?>'.'</span></label><br />'."\n\t\t".'<span class="frm-input"><select id="qjump-select" name="id">'."\n";

        // Get the list of categories and forums from the DB
        $query = array(
            'SELECT'    => 'c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url',
            'FROM'        => 'categories AS c',
            'JOINS'        => array(
                array(
                    'INNER JOIN'    => 'forums AS f',
                    'ON'            => 'c.id=f.cat_id'
                ),
                array(
                    'LEFT JOIN'        => 'forum_perms AS fp',
                    'ON'            => '(fp.forum_id=f.id AND fp.group_id='.$group_id.')'
                )
            ),
            'WHERE'        => 'fp.read_forum IS NULL OR fp.read_forum=1',
            'ORDER BY'    => 'c.disp_position, c.id, f.disp_position'
        );

        ($hook = get_hook('ch_fn_generate_quickjump_cache_qr_get_cats_and_forums')) ? eval($hook) : null;
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

        $cur_category = 0;
        $forum_count = 0;
        $sef_friendly_names = array();
        while ($cur_forum = $forum_db->fetch_assoc($result))
        {
            ($hook = get_hook('ch_fn_generate_quickjump_cache_forum_loop_start')) ? eval($hook) : null;

            if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?
            {
                if ($cur_category)
                    $output .= "\t\t\t".'</optgroup>'."\n";

                $output .= "\t\t\t".'<optgroup label="'.forum_htmlencode($cur_forum['cat_name']).'">'."\n";
                $cur_category = $cur_forum['cid'];
            }

            $sef_friendly_names[$cur_forum['fid']] = sef_friendly($cur_forum['forum_name']);
            $redirect_tag = ($cur_forum['redirect_url'] != '') ? ' &gt;&gt;&gt;' : '';
            $output .= "\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.forum_htmlencode($cur_forum['forum_name']).$redirect_tag.'</option>'."\n";
            $forum_count++;
        }

        $output .= "\t\t\t".'</optgroup>'."\n\t\t".'</select>'."\n\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" onclick="return Forum.doQuickjumpRedirect(forum_quickjump_url, sef_friendly_url_array);" /></span>'."\n\t".'</div>'."\n".'</form>'."\n";
        $output .= '<script type="text/javascript">'."\n\t\t".'var forum_quickjump_url = "'.forum_link($forum_url['forum']).'";'."\n\t\t".'var sef_friendly_url_array = new Array('.$forum_db->num_rows($result).');';

        foreach ($sef_friendly_names as $forum_id => $forum_name)
            $output .= "\n\t".'sef_friendly_url_array['.$forum_id.'] = "'.forum_htmlencode($forum_name).'";';

        $output .= "\n".'</script>'."\n";

        if ($forum_count < 2)
            $output = '<?php'."\n\n".'if (!defined(\'FORUM\')) exit;'."\n".'define(\'FORUM_QJ_LOADED\', 1);';

        fwrite($fh, $output);

        fclose($fh);
    }

Re: Installing on SourceForge

Oh-oh, it is harder with cache_quickjump_*.php.

I will try to write an extension tomorrow. This will be a useful experience as I want to make PunBB 2.0 enabled to work without cache.

Carpe diem

11

Re: Installing on SourceForge

Anatoly wrote:

Oh-oh, it is harder with cache_quickjump_*.php.

I will try to write an extension tomorrow. This will be a useful experience as I want to make PunBB 2.0 enabled to work without cache.

yikes PunBB 2.0!

Re: Installing on SourceForge

Anatoly wrote:

Oh-oh, it is harder with cache_quickjump_*.php.

I will try to write an extension tomorrow. This will be a useful experience as I want to make PunBB 2.0 enabled to work without cache.

That would be great.

Another problem though.  I deleted the old database and the config.php file to do a reinstall but I get this error:

An error was encountered

Unable to connect to MySQL server. MySQL reported: Access denied for user 'noneofyourbusiness'@'123.456.78.90' (using password: YES)

The error occurred on line 45 in /home/groups/l/li/linuxforclinics/htdocs/forum/include/dblayer/mysql.php

What could be causing it and how do I fix it?  I am putting the username and password in correctly (copy/pasting it in) so that isn't it.

13

Re: Installing on SourceForge

Didn't you delete the database?

Re: Installing on SourceForge

Garciat wrote:

Didn't you delete the database?

Yes.  I said so when I typed "deleted the old database"

15

Re: Installing on SourceForge

theforkofjustice wrote:
Garciat wrote:

Didn't you delete the database?

Yes.  I said so when I typed "deleted the old database"

I think you didn't get my point. I was trying to say that you may have forgotten to create the new database.

Re: Installing on SourceForge

Garciat wrote:
theforkofjustice wrote:
Garciat wrote:

Didn't you delete the database?

Yes.  I said so when I typed "deleted the old database"

I think you didn't get my point. I was trying to say that you may have forgotten to create the new database.

Then you should have said 'create' instead of 'delete' wink

Okay, I created the database (thought punbb did that itself) and punbb added the tables.  The database is fine now, I uploaded the config.php file and uploaded the blank php files to /cache.   All 'should' be working but I get a blank screen instead.  Now I'm beginning to miss those bothersome error messages sad

By any chance are the skins for 1.2 compatible for 1.3?

Re: Installing on SourceForge

theforkofjustice wrote:

Now I'm beginning to miss those bothersome error messages sad

By any chance are the skins for 1.2 compatible for 1.3?

No chance.

Be sure: error messages will come back to you wink

Carpe diem

18

Re: Installing on SourceForge

hi

Latest phpBB works on Sourceforge.net
http://wiki.freegamedev.net/index.php/Sourceforge_phpBB

Then i have get successfull worked the cache and other things.
Mean can use same install method for PunBB too?

i will install PunBB forum on my  sourceforge.net Project , i will look if it will work.

19 (edited by theforkofjustice 2008-11-12 01:28)

Re: Installing on SourceForge

Anatoly wrote:
theforkofjustice wrote:

Now I'm beginning to miss those bothersome error messages sad

By any chance are the skins for 1.2 compatible for 1.3?

No chance.

Be sure: error messages will come back to you wink

I removed it to be safe. I can put it back later with edited css files and no 'import' folder so it will look like the way Oxygen is set up.  I'll test it when all is well.

Hows the no-cache extension coming?

Re: Installing on SourceForge

clunky wrote:

hi

Latest phpBB works on Sourceforge.net
http://wiki.freegamedev.net/index.php/Sourceforge_phpBB

Then i have get successfull worked the cache and other things.
Mean can use same install method for PunBB too?

i will install PunBB forum on my  sourceforge.net Project , i will look if it will work.

I took a look at the steps and don't understand a few things:

cd $projecthome/htdocs/forum
# if it does not exist yet
mkdir /tmp/persistent/projectname
# organisation is a good habit ;)
mkdir /tmp/persistent/projectname/forum
# move the directories
mv cache /tmp/persistent/projectname
mv files /tmp/persistent/projectname
mv store /tmp/persistent/projectname
mv images/avatars/upload /tmp/persistent/projectname
# create appropriate symlinks
ln -sf /tmp/persistent/projectname/cache
ln -sf /tmp/persistent/projectname/files
ln -sf /tmp/persistent/projectname/store
ln -sf /tmp/persistent/projectname/upload images/avatars/upload
# set appropriate permissions
chmod 777 /tmp/persistent/projectname/forum/*
  • I don't see the /tmp folder in my project or user webspace
    I DO have a 'persistent' folder but don't know how to use it 
    And I'm very certain webspace applications can't write to the webspace even if you upload blank cache files and change their permissions to 755 mad

If there were a way to symlink to a writable directory I'd be in business but no luck yet.  Can someone explain these instructions to me?  I may be missing something but I can't see how they are adaptable to punbb (or even how they work for phpbb).

Re: Installing on SourceForge

Anatoly wrote:

I will try to write an extension tomorrow. This will be a useful experience as I want to make PunBB 2.0 enabled to work without cache.

theforkofjustice wrote:

Hows the no-cache extension coming?

Sorry, I must have promised too much.
I will be able to try this only next week.
But I ask other devs to try to create such an extension.

theforkofjustice wrote:

If there were a way to symlink to a writable directory I'd be in business but no luck yet.  Can someone explain these instructions to me?  I may be missing something but I can't see how they are adaptable to punbb (or even how they work for phpbb).

1. Looks like /tmp/ is a global temp directory shared between all the projects. If it is really so, it is unsafe to write there: any other project will be able to read your cached config and DB password or just write its' own PHP-code into cache file.
2. If I am wrong and only you can read from /tmp/persistent/projectname, just create the directories there and make symlinks to them in place of <PUNBB_ROOT>/cache/ and <PUNBB_ROOT>/img/avatars/. Looks like this should work.

Carpe diem

22 (edited by clunky 2008-11-12 20:10)

Re: Installing on SourceForge

install phpBB its little bit different.
and the howto for phpBB seems not more up to date.

I get installed punBB on sourceforge without problems too:

sftp://username,myproject@web.sourceforge.net/home/groups/m/my/myproject/htdocs/forum 

mkdir /home/groups/m/my/myproject/persistent/cache

symlink /home/groups/m/my/myproject/persistent/cache /home/groups/my/myproject/htdocs/forum/cache

mkdir /home/groups/m/my/myproject/persistent/img/avatars

symlink /home/groups/m/my/myproject/persistent/img/avatars /home/groups/m/my/myproject/htdocs/forum/img/avatars

Change the rights of /home/groups/m/my/myproject/htdocs/forum/cache (a+rwx)
Change the rights of /home/groups/m/my/myproject/htdocs/forum/img/avatars (a+rwx)

Dont copy the cache and the img/avatars folder to /htdocs/forum/ on sourceforge!

23

Re: Installing on SourceForge

theforkofjustice wrote:

I don't see the /tmp folder in my project or user webspace
I DO have a 'persistent' folder but don't know how to use it 
And I'm very certain webspace applications can't write to the webspace even if you upload blank cache files and change their permissions to 755 mad


If there were a way to symlink to a writable directory I'd be in business but no luck yet.  Can someone explain these instructions to me?  I may be missing something but I can't see how they are adaptable to punbb (or even how they work for phpbb).

the howot for phpBB is not realy up to date with SourceForge changes.

you must create on your 'persistant' folder

1. 'cache' folder and a 'img/avatar' folder

2. remove the folders from  forum/'cache' and forum'/img/avatars'

3. now you does make symlink

symlink /home/groups/m/my/myproject/persistent/cache /home/groups/my/myproject/htdocs/forum/cache
symlink /home/groups/m/my/myproject/persistent/img/avatars /home/groups/m/my/myproject/htdocs/forum/img/avatars

At last you must set the rights for this folders  forum/'cache' forum/'img/avatars'  777.

i used winscp for that set rights , i doest get worked under linux that and dont know how.

Re: Installing on SourceForge

I (WE) DID IT!

http://linuxforclinics.sourceforge.net/forum/

Steps to getting PunBB 1.3 to work on SF.net without altering a single file:

1) Figure out how to connect to your webspace (read up on SF.net's documentation on the matter) and create a folder in your 'htdocs' and 'persistent' directories for where you want to install punbb.  I chose 'forum' for both.
2) Connect to the phpmyadmin interface and create a blank database.  You will need to read up on the procedure using SF.net's documentation on the matter.  REMEMBER THE NAME OF THE DATABASE YOU CREATE AND THE PREFIX ALL YOUR DATABASES WILL HAVE
3) Upload punbb's files to your SF.net webspace as directed here:

'cache' directory and files = persistent/forum/cache
'img/avatars' directory and files = persistent/forum/img/avatars
all other files and folders = htdocs/forum

NOTE1 :  .htaccess files won't upload automatically if your filepath in the put command uses a wildcard (ex - put cache/*) .  Remember to upload them specifically with a direct path (ex - put cache/.htaccess)

NOTE 2: I created a number of blank files and uploaded them to the 'persistent/forum/cache' directory.  I didn't bother checking if they would be made automatically by punbb once permissions are changed (they should but I didn't test it).  The blank files you will upload to the 'persistent/cache' directory will be named:

cache_bans.php
cache_censors.php
cache_config.php
cache_ext_version_notifications.php
cache_forum.php
cache_hooks.php
cache_quickjump.php
cache_ranks.php
cache_updates.php

4) Create these symlinks (alter the code to match your project):

symlink /home/groups/m/my/myproject/persistent/forum/cache /home/groups/m/my/myproject/htdocs/forum/cache
symlink /home/groups/m/my/myproject/persistent/forum/img/avatars /home/groups/m/my/myproject/htdocs/forum/img/avatars

NOTE: The actual 'cache' and 'img/avatars/ directory SHOULD NOT exist in the 'htdocs' section.  If you accidentally uploaded them to 'htdocs/forum' then delete them before making the symlinks and double check if they are in the 'persistent/forum' area as this tutorial demonstrates.

5) Change the permissions of the 'cache' and 'img/avatars' folders and their contents to 0777

chmod 0777 foldername/filename

NOTE: You may have to chmod the symlinks as well as the 'persistent/forum' and 'persistent/forum/img' directories.  I'm too lazy to check if this is what made the forum finally work.

6) Go to http://yourproject.sourceforge.net/foru … nstall.php and begin the installation process.  Input the correct values in the correct blanks and upload the config.php file to your root directory when asked.  PunBB 1.3 should install flawlessly (and it is about time too).

I hope I took correct notes.  Can someone who has a minute check my procedure for errors if they have a few minutes?

25

Re: Installing on SourceForge

Congratulations!