A web developer’s diary

October 12, 2006

OPEN_BASEDIR RESTRICTION IN EFFECT error

Filed under: PHP — Celia @ 6:09 am

When a client was trying to install a script of mine, he got this below error.

Warning: main() [function.main]: open_basedir restriction in effect. File(/script.php) is not within the allowed path(s):

This problem happens mostly on shared networks. The hosting provider would have enabled the ‘open_basedir’ restriction on the server to prevent the user from using php scripts on that particular folder.

In this case, either of the following solutions would work.

1) The host should disable the restriction.
2) Or the host can add the ‘concerned folder path’ to the list of allowed folders.

Once the problem was traced out and fixed, my client was able to install it.

For the hosting providers:

At times, it is needed to restrict file operations for a particular user to their own home or web directories. This can be done easily in PHP by setting the open_basedir variable in PHP.ini. For instance,

open_basedir = /home/website/

will restrict the user to place his files only in this directory. The scripts placed outside won’t run at all. Again, if some user comes to you stating that he gets open_basedir error, you can either reset this variable or ask him to install the product in his restricted directory.

Advertisements

1 Comment »

  1. Sadly in my case, the host disables it 😦

    Comment by Rhonnie — December 3, 2009 @ 12:27 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: