This topic was marked solved by Arantor, on August 1st, 2013, 06:03 AM
« SMorg
open_basedir and Load Balancing Page Errors

Anthony`

  • Posts: 53
open_basedir and Load Balancing Page Errors
« on November 7th, 2012, 10:31 PM »
Trying to view the page shows a blank page.

I investigated and found the cause on line 471 in ManageServer.php,
Code: [Select]
$settings['load_average'] = @file_get_contents('/proc/loadavg');

When I remove the supression operator, I get the following errors,
Quote
Warning: file_get_contents() [function.file-get-contents]: open_basedir restriction in effect. File(/proc/loadavg) is not within the allowed path(s): (/home/...:usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /.../wedge/Sources/ManageServer.php on line 471

Warning: file_get_contents(/proc/loadavg) [function.file-get-contents]: failed to open stream: Operation not permitted in /.../wedge/Sources/ManageServer.php on line 471

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Anthony`

  • Posts: 53

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: open_basedir and Load Balancing Page Errors
« Reply #4, on November 7th, 2012, 11:36 PM »
It's more of a server security issue. I remember having the problem at an earlier host. The current one supports this but the only difference is I can see the load average, that's all... If it's not supported -- it doesn't show anything.

Not a biggie IMHO.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,063

Anthony`

  • Posts: 53
Re: open_basedir and Load Balancing Page Errors
« Reply #7, on November 8th, 2012, 04:16 AM »
I went back into the code and the cause of the blank page seems to be the backtick operator executing the shell command here:
Code: [Select]
elseif (($settings['load_average'] = @`uptime`) !== null && preg_match('~load averages?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $settings['load_average'], $matches) !== 0)

I suspect it's somewhat like my experience in an earlier bug report with exec(?) hanging on me and producing a blank page as well.

Again, removing the supression operator and I get the following error:
Quote
Warning: shell_exec() has been disabled for security reasons in /.../wedge/Sources/ManageServer.php on line 474

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: open_basedir and Load Balancing Page Errors
« Reply #8, on November 8th, 2012, 08:48 AM »
So, I've replaced this internally with @shell_exec('uptime')... Can you do the same and tell me if it works this time..?
(There's also another occurrence in Load.php, BTW. Done too.)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Anthony`

  • Posts: 53
Re: open_basedir and Load Balancing Page Errors
« Reply #10, on November 8th, 2012, 10:18 PM »
Quote from Nao on November 8th, 2012, 08:48 AM
So, I've replaced this internally with @shell_exec('uptime')... Can you do the same and tell me if it works this time..?
(There's also another occurrence in Load.php, BTW. Done too.)
Still get a blank page and when I take off supression:
Quote
Warning: shell_exec() has been disabled for security reasons in /.../wedge/Sources/ManageServer.php on line 474
Quote from Arantor on November 8th, 2012, 04:14 PM
I don't get why it's white-screening instead of just giving you an actual error, though.
Well, I can see why it wouldn't output the error because it's supressed of course but I don't know why it would just hang PHP like this... Do all shell commands do this? -_-


Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278