You are not logged in.

#1 2009-11-11 03:27:38

timm
Member
From: Wisconsin
Registered: 2004-02-25
Posts: 417

open_basedir restriction error - php

I'm running mythtv on one box, and connecting to it with mythweb from another.  I have php errors turned on as I had some configuration errors when I updated php.

I am now getting the following error:

Error at /srv/www/mythweb/includes/modules.php, line 28:
file_exists(): open_basedir restriction in effect. File(./modules/welcome.php/init.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/srv/www/)

I don't understand the

File(./modules/welcome.php/init.php)

part of that, there is no welcome.php directory.

In php.ini, I have

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/srv/www/

and every instance of welcome.php and init.php is in the /srv/www/ path.

What am I missing?

Last edited by timm (2009-11-11 13:48:40)

Offline

#2 2009-12-03 12:56:38

chair
Member
From: Sydney, Australia
Registered: 2006-06-12
Posts: 27

Re: open_basedir restriction error - php

The same thing has been happening to me since a php update a month ago.

I've got no idea what's wrong, maybe a bug in the php package?

Offline

#3 2009-12-03 13:04:12

chair
Member
From: Sydney, Australia
Registered: 2006-06-12
Posts: 27

Re: open_basedir restriction error - php

Commenting out the "open_basedir" line in php.ini gets rid of the error message, I don't know if it's a security risk. My server isn't open to the internet anyway.

Last edited by chair (2009-12-03 13:05:17)

Offline

#4 2009-12-03 13:20:52

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Re: open_basedir restriction error - php

Unless I'm mistaken, there was a subtle difference between /srv/www/ and /srv/www (without trailing slash) for open_basedir.

I think writing /srv/www/ will allow only this directory and no subdirectories whilst using /srv/www will allow this directory and subdirectories.

Offline

#5 2010-01-30 23:37:08

PelzigesOhr
Member
Registered: 2010-01-30
Posts: 3

Re: open_basedir restriction error - php

Just like timm I believe it's an error in the code. Obviously welcome.php/init.php doesn't exist. I created a bugreport including a very cheap fix:
http://svn.mythtv.org/trac/ticket/7997

Here's the text of the bugreport, if you're too lazy to go there by yourself:


Hi,

I already saw the 2 similar bugs that won't get fixed, but I believe that the code is still faulty. Have a look at the thrown message: "Warning at /srv/http/mythweb/classes/Modules.php, line 30: file_exists(): open_basedir restriction in effect. File(./modules/welcome.php/init.php) is not within the allowed path(s): (/srv/http)

In fact, the file ./modules/welcome.php/init.php is nonexistent. Modules.php makes a list of files in the modules directory, assumes they are subdirectories and tries to load init.php in each of the directories. welcome.php isn't a directory, hence you shouldn't treat it as one.

Here's a cheap fix: In includes/utils.php is a function called get_sorted_files. Replace

if ($file == '.' $file == '..') continue;

with

if ($file == '.' $file == '..' $file == 'welcome.php') continue;

Probably there's someone that can do a lot better than this, but this did it for me.

Offline

Board footer

Powered by FluxBB