1

(118 replies, posted in Supported extensions)

When I try to install 1.0.1 it errors out because it can't copy .htaccess to the random directory it generates.  The random directory it generates belongs to apache:apache and has permissions 750.  Is there any way I can modify the extension to create the directory using a user:group of my choosing?

2

(32 replies, posted in PunBB 1.3 extensions)

[spoiler][/spoiler] tags.  Just make the text and background black and turn text white on highlight.

parpalak wrote:

Thanks for the detailed information. Looks like a command fopen('...', 'wb') fails. Is there a directory in extensions/ after this failure? In other words, please, run this command
ls /some_path/forum/extensions/ -la
EDIT: Well, I have already understood that there will be nothing

I couldn't reproduce this bug on my hosting. I ask you to edit sources of pun_repository (for bug searching). Can you do it for PunBB, please?

If yes, comment or remove the following lines (about 129-130) in pun_repository.php
        unlink(FORUM_ROOT.'extensions/'.$ext_id.'.tgz');
        @pun_repository_rm_recursive(FORUM_ROOT.'extensions/'.$ext_id);
and then see the output ofls /some_path/forum/extensions/ -la and ls /some_path/forum/extensions/pun_antispam/ -la (or any other extension that you will to install via pun_repository).

Last edited by parpalak (Yesterday 12:45:50)

No, there was no directory in there when I got a failed install originally (I did install these manually later, but I still want to troubleshoot how pun_repository works).

I commented out those lines for you in pun_repository.php, I assume that means that it won't remove the directory and archive if it fucks up.  Right now, I am testing by installing extension pun_bbcode via pun_repository.

This is what happens when I now attempt it:

Error from forum:
ERROR! Files could not be extracted from the downloaded archive. The next errors appear while extracting:
Error while opening {'../extensions/pun_bbcode/styles.css'} in write binary mode

ls -lah /some_path/forum/extensions | grep pun_bbcode
drwxrwxrwx 2 apache  apache 4.0K Nov 22 12:17 pun_bbcode
-rw-r--r-- 1 apache  apache  13K Nov 22 12:17 pun_bbcode.tgz

NOTE:  My punbb install is on a Plesk domain, and Plesk typically forces web content to have the following ownership scheme
user: username associated with domain
group: always 'psacln'

Now, there's nothing at all in the apache error_log, so this has got to be a permissions issue based on my environment.  This is further proven since the archive has 644 perms belonging to the apache user, and the resulting directory is empty.

Is there anyway anything can be done from the development end to catch this?  Or should I just continue to install extensions manually?

4

(52 replies, posted in PunBB 1.3 additions)

Thanks!

5

(52 replies, posted in PunBB 1.3 additions)

I would like a theme that resizes the width of the content on the page based on the resolution.  It seems to top out at 1100 pixels neutral

Anatoly wrote:

PunBB 1.3, all current hotfixes (three) installed, pun_repository 1.2.2 and pun_pm 1.2.2. 0777 set for ./extensions/. Yup?

OS/Apache/PHP versions?

We'll try to reproduce.

                        Carpe diem

Running punbb 1.3 (migration from old 1.2 install, never got any errors on database conversion)
All three hotfixes installed successfully
Only extension installed is pun_repository 1.2.2

Path permissions should be fine:
[root@nozomu ~]# ls -ld /some_path/forum/extensions/
drwxrwxrwx 3 user group 4096 Nov 21 10:29 /some_path/forum/extensions/

OS (CentOS 5.x)
[root@nozomu ~]# cat /etc/redhat-release
CentOS release 5.2 (Final)

Apache Version:
[root@nozomu ~]# httpd -v
Server version: Apache/2.2.3
Server built:   Jan 15 2008 20:33:30

PHP Version:
[root@nozomu ~]# php -v
PHP 5.2.6 (cli) (built: May  5 2008 18:16:01)
Copyright (c) 1997-2008 The PHP Group

MySQL Version:
[root@nozomu ~]# mysql -V
mysql  Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (i686) using readline 5.0

Errors:

From forum software:
ERROR! Files could not be extracted from the downloaded archive. The next errors appear while extracting:
Error while opening {'../extensions/pun_antispam/index.html'} in write binary mode

From apache error_log:

[Fri Nov 21 10:23:22 2008] [error] [client x.x.x.x] PHP Notice:  Undefined index:  Install extensions in /some_path/forum/admin/extensions.php(664) : eval()'d code on line 195, referer: http://some_domain/forum/admin/extensions.php?section=manage
[Fri Nov 21 10:23:22 2008] [error] [client x.x.x.x] PHP Notice:  Undefined index:  admin_extensions_install in /some_path/forum/admin/extensions.php(664) : eval()'d code on line 195, referer: http://some_domain/forum/admin/extensions.php?section=manage

I was able to install the extensions manually.

[Mon Jan 28 10:15:03 2008] [error] [client xxxxxxxxx] PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/proc/loadavg) is not within the allowed path(s): (/home/vhosts/domain.com/httpdocs:/tmp) in /home/httpd/vhosts/domain.com/httpdocs/forum/admin_index.php on line 79, referer: /home/httpd/vhosts/domain.com/forum/admin_options.php

Plesk has default rules about open_basedir in each domain's httpd.include file and removing the @ revealed that it wasn't letting PHP access /proc/loadavg at all.  Your new solution from PunBB 1.3 Dev works just fine since my PHP is >= 5.1.3.  If one is using Plesk as I am, one can also edit the domain's vhost.conf file (in the conf directory at the domain's root) to override the setting, but that may not be feasible depending on ones level of access.

Here are the adjustments Rickard suggested you can make to admin_index.php if you have this issue.  Remember PHP Version >= 5.1.3 is required

Find:

if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg'))

Replace With:

else if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg'))

Before, Add:

if (function_exists('sys_getloadavg'))
{
    $load_averages = sys_getloadavg();
    array_walk($load_averages, create_function('&$v', '$v = round($v, 3);'));
    $server_load = $load_averages[0].' '.$load_averages[1].' '.$load_averages[2];
}

Thanks again for your help, Rickard.  It is greatly appreciated.

Version: 1.2.16
PHP: 5.2.5 /w eAccelerator 0.9.5.2
OS: Linux

Recently, I have had more time to administrate my forum (and my server in general), and I have been going back to make enhancements and fixes to my forum.  Thanks to another thread on a forum, I was able to tweak it so that PunBB checked the php.ini to see if eAccelerator is installed (the current version only checked for MMCache and ionCube Accelerator, which haven't been updated in ages neutral ).  The Load Average reporter on the same admin_index.php page, however always says "Not Available".  I looked into the code and it makes sense:

// Get the server load averages (if possible)
if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg'))
{
    // We use @ just in case
    $fh = @fopen('/proc/loadavg', 'r');
    $load_averages = @fread($fh, 64);
    @fclose($fh);

    $load_averages = @explode(' ', $load_averages);
    $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available';
}
else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', @exec('uptime'), $load_average$
    $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3];
else
    $server_load = 'Not available';

.
.
.

 <?php echo $server_load ?>

Im concerned with the if since it's Linux.  Checks if /proc/loadavg exists and is readable, then opens it for reading, sticks it in $load_averages, and closes that file. 

Ok yeah, I follow:

<?php
if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg'))
{
    // We use @ just in case
    $fh = @fopen('/proc/loadavg', 'r');
    $load_averages = @fread($fh, 64);
    @fclose($fh);
}
echo $load_averages
?>

su webusername -
$ php blah
0.00 0.00 0.00 1/153 816

Then, it uses explode() to delimit load_averages into its own array using space as a delimiter, followed by asking if the 3rd element of the array (the past 15 min load average) is actually set to something.  Obviously since it was, the $server_load variable is set to the first 3 elements in load_averages separated by spaces.  So, everything's cool right?  Should be reporting the 1, 5, and 15 minute load averages to the admin_index page right?

<?php
if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg'))
{
    // We use @ just in case
    $fh = @fopen('/proc/loadavg', 'r');
    $load_averages = @fread($fh, 64);
    @fclose($fh);

    $load_averages = @explode(' ', $load_averages);
    echo $load_averages[2]."\n";
    $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available';
}
echo $server_load;
?>

su webusername -
$ php blah
0.00
0.00 0.01 0.00

The sucky part is that my admin_index.php page is still reporting "Not Available", which means according to the code, it can't detect the OS or it detects linux and couldn't read /proc/loadavg correctly.  I ran my test code as the same user and permissions that the admin_index.php page has, in the same directory, so I'm not really too sure why this is happening.  The only thing I can think of is that Apache is screwing it up somehow, but I wouldn't know how to troubleshoot that.  I am fairly inexperienced, so I might be missing something major here.  Please let me know if you have any questions about my setup.  Thank you.