Page 1 of 1

Open basedir and file_exists

Posted: Tue Jun 27, 2006 2:56 pm
by deathline

Code: Select all

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/data/web/virtuals/_/www/s9y/ is not within the allowed path(s): (/data/web/virtuals/ in /data/web/virtuals/ on line 164

line 164-175

Code: Select all

if (file_exists($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/')) {
    $local_config = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/';
} elseif (file_exists($serendipity['serendipityPath'] . '/')) {
    $local_config = $serendipity['serendipityPath'] . '/';
} elseif (defined('S9Y_DATA_PATH')) {
    // Shared installation!
    $local_config = 'data/web/virtuals/' . '/';
} else {
    // Installation fallback
    $local_config = S9Y_INCLUDE_PATH . '/';

I solved this problem in deleting some codes and a little editing in this file which is written above.First fourth raw deleted and used "if" instead of second "elseif"

Now s9y work good but, will it be a problem next time?


Re: Open basedir and file_exists

Posted: Tue Jun 27, 2006 3:15 pm
by garvinhicking

Instead you should talk to your provider, he has not properly setup your open_basedir path(s).

The fix you made will be overwritten for the next s9y update, since the original code used by Serendipity is the proper one, as long as open_basedir is properly configured...

HTH and best regards,

Re: Open basedir and file_exists

Posted: Sun Mar 31, 2013 5:55 am
by orang
Hi there,

I have the same problem described above.

I have actually two serendipity softwares installed on my webspace ( and and both of them are displaying since a couple of weeks the same error messages:

Warning: file_exists(): open_basedir restriction in effect. File(/customers/ is not within the allowed path(s): ...

Both of them have been running without any problems since more than at least 6 years without them being changed by me in any way and now, all of a sudden, they both don't work anymore - displaying the same error message. I had a long chat with my provider and I even pointed them to this thread here, at the end of which he stated:
unfortunately, we can't help you regarding this since open_basedir is not going to be altered in any way, you may also ask for some suggestions on that forum on how to fix it since they are in control of your software which "Serendipity"
What else can I do?


Re: Open basedir and file_exists

Posted: Sun Mar 31, 2013 1:16 pm
by Timbalu
orang wrote:... displaying since a couple of weeks the same error messages...
That short...? You don't seem to need your installations... :-)

If you google this, this isn't really the fault of the software used, it is by your servers (ISPs) configuration, as Garvin pointed out.
Therefor they should be able to solve this for you (and all their other customers). I found a lot of others with the same crude open_basedir error messages... based on corresponding server environments (or same provider).

The message displayed is clear: the path and file on demand is NOT in the allowed open_basedir() paths. What is the correct system file path that is allowed and correct accessible by your ISP?

You can either test what you Server configuration tells you

Code: Select all

echo "1: " . $_SERVER['DOCUMENT_ROOT'] . "<br>\n";
echo "2: " . dirname($_SERVER['PHP_SELF']) . "<br>\n";
echo "3: " . $serendipity['serendipityPath'] . "<br>\n";
echo "4: " . S9Y_DATA_PATH . "<br>\n";
echo "5: " . getcwd() . "<br>\n";
echo "6: " . dirname(__FILE__) . "<br>\n";
Put that into a mypathtests.php file in your Home directory and access it via browser.
What is the scripts output and which path is not a real (allowed and accessible) path? Of very interest is also number 3. Is it still an allowed and acessible path? Maybe that has changed...?! If so, you need to modify the value of serendipityPath in the *_config table of you database.

The path not found error is this, for example....

Code: Select all

as it says:

Code: Select all

Warning: file_exists(): open_basedir restriction in effect. 
is not within the allowed path(s):
in .... file
Are you sure it should'nt be either:

Code: Select all


Code: Select all

or some other path?

First, try to add

Code: Select all

php_admin_value open_basedir none
on top of your Serendipity .htaccess files to disable open basedir in your blogs.

If that does not help, you can try to set the correct path via ini_set():
As of PHP 5.3.0 open_basedir can be tightened at run-time. This means that if open_basedir is set to /www/ in php.ini a script can tighten the configuration to /www/tmp/ at run-time with ini_set(). When listing several directories, you can use the PATH_SEPARATOR constant as a separator regardless of the operating system.

Second, it ~might~ help to add an empty 404.tpl file to your theme testwise, to circumvent the restriction message on a file which is actually not a real file. Does that change the errors?

Please provide some more info about server configuation, system info, S9y and PHP Versions.

Re: Open basedir and file_exists

Posted: Tue Apr 02, 2013 2:37 am
by orang
Hi Ian,

Thank you very much for your help, I haven't gotten around trying out what you pointed out in your post up until now.

Customer service told me when I chatted with him, the correct path is:

Code: Select all

Which seems right, since this is also the number 1 in the mypathtest file that you wrote.

I'm using Serendipity 1.5.5, PHP is 5.3.23 and phpinfo() tells me about the system:

Code: Select all

Linux web157.local 3.4.35-20130304-0940-ef1617a #1 SMP Mon Mar 4 09:42:04 UTC 2013 x86_64 
this is from
I set up a mypathtest.php here: And you can see that concerning #3, nothing is displayed. I'm not sure what that means. I tried the edit to the .htaccess file you mentioned, but it didn't seem to help.

I do understand that it is a server side problem, however I don't understand how it could occur. As much as I didn't understand how I can "tighten the .ini at run-time".
This is all very strange to me still, they must have changed something and are now unwilling to change it back. I haven't talked to them again since.


Re: Open basedir and file_exists

Posted: Tue Apr 02, 2013 11:26 am
by Timbalu
This does look like they have changed the path from
If you had a previous install, you will possibly have an old path set in your database config table. Have a look at it before changing.
Update the path with the following SQL statement (replacing the PREFIX with yours, normally serendipity_config):

Code: Select all

SET value = '/customers/d/f/6/'
WHERE name = 'serendipityPath';
and the same for the /bib/ installation. If that was the main problem you should kick them in the ...! They should have told you.

I am surprised that dirname($_SERVER['PHP_SELF']) is empty.... (*)
You could try to add to the test script:

Code: Select all

echo '2.1: ' . $_SERVER['PHP_SELF'] ."<br>\n";
echo '2.5: ' . basename(__DIR__) ."<br>\n";
Normally the dirname($_SERVER['PHP_SELF']) should be "/kfd" or "/bib" in your environment.
so that

Code: Select all

$_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/';
would give the correct path
(*) well, not if in webservers root... There dirname would be nothing...

It might also well be they have updated the PHP version to now 5.3.23, which is a step stricter in noting changed coding standards. If all that mentioned above has been solved, you should update Serendipity to the latest available version 1.7 RC3, or wait some more days until we release the 1.7 final. Before updating Serendipity you have to make sure to get all updated plugins and also templates first (costa for example has changed).

Re: Open basedir and file_exists

Posted: Wed Apr 03, 2013 3:23 am
by orang
Hi Ian,

Thanks so much for your reply.

The update change that you mentioned concerning the serendipity_config table worked for the /kfd/. So I updated the path and the site is back now as usual.

However there are seem to be more problems with the /bib/ installation. I wonder whether that is, because it is an older serendipity version. I have to admit that no one uses this website right now, but it contains information that is useful to have as an archive thing... So, it would be nice to have it back on.
After I changed the path, I had the deprecated error message, so I changed the error report line in the config_inc.php, but now I only get a blank page and I don't seem to be able to get proper error messages. Do you have an idea how to get an error output at all or what the problem could be? I'm not even sure, how to find out the serendiptiy version, the files date back from 2008...

I put up an error.php containing:
ini_set ('track_errors', 1);
ini_set ('log_errors', 1);
ini_set ('error_log', '/customers/d/f/6/');
But the error_log remains empty.

Thanks again!

Re: Open basedir and file_exists

Posted: Wed Apr 03, 2013 8:54 am
by Timbalu
Well, a white page of death means fatal error, which should be logged somehow to the server logs. Ask your ISP about that. How in detail did you silence the error reporting deprecated warnings?

What kind of useful information does that bib page provide. Is it changed serendipity code or just some old entries you want to save? If the last, take the latest stable Serendipity 1.6.2 and copy it onto your bib installation. That will most likely solve the white page and keep it running after changing the error reporting variable in like this

Code: Select all

error_reporting(E_ALL & ~E_NOTICE ^ E_DEPRECATED);
~line 54