Solved

Warning: Unknown(): open_basedir restriction in effect.

Posted on 2007-04-11
10
961 Views
Last Modified: 2008-02-01
Hi Fellow Experts,

I am getting this php error on a LAMP setup on a shared hosting server...

Warning: Unknown(): open_basedir restriction in effect.

Using .htaccess or any other means, how can i overide this.  Its set in php.ini.

Could i drop a new php.ini in the directory? What lines could i put in .htaccess ... or is there any other way?

ini_set() function in php does not seem to be working at all.

Thanks!
0
Comment
Question by:NIPPLES
  • 5
  • 3
  • 2
10 Comments
 
LVL 24

Accepted Solution

by:
glcummins earned 125 total points
ID: 18893152
open_basedir cannot be overridden. It is put in place to prevent one site on a shared server from accessing or overwriting data in another site. Allowing the various site operators to override this setting would defeat the purpose.

You will need to contact your hosting provider to change the settings, if it can be changed at all.
0
 
LVL 3

Author Comment

by:NIPPLES
ID: 18893280
So there is no "black hat" method?  I don't want to wake up my sysadmin halfway around the world just switch on a setting in php.ini!
0
 
LVL 3

Author Comment

by:NIPPLES
ID: 18893295
Forgot to say that this is my server, running several sites - not a 3rd party.  So nothing naughty going on.

Cheers.
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 18893316
>>> So there is no "black hat" method?

That is contrary to the guidelines of EE.  Please refer:

http://www.experts-exchange.com/help.jsp#hi100

As glcummins explained, there are very good reasons that restriction is placed on a server, especially if it is a shared host.  I recommend you look at adjusting your code to account for it.  

Why do you feel you need to access outside of your directory tree?
0
 
LVL 24

Expert Comment

by:glcummins
ID: 18893328
There is no above-board method that would get this done for you without editing the main php.ini file and restarting Apache. Other, less scrupulous, methods may be available, but this is not the forum to discuss them.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 50

Expert Comment

by:Steve Bink
ID: 18893352
LOL...wish I had refreshed before posting.  :)  That does change things.

You'll still have to edit where that restriction is being set.  It could be set in php.ini, or even in a <VirtualHost> container in Apache conf files.  I would recommend you see here:

http://www.php.net/manual/en/ini.php

Note that this setting is affected by PHP's safe mode.  You'll need to examine that setting as well.  Check here for more information:

http://www.php.net/manual/en/features.safe-mode.php
0
 
LVL 3

Author Comment

by:NIPPLES
ID: 18893362
Thanks for your help routinet,

>>> http://www.experts-exchange.com/help.jsp#hi100

"Hacks" are about 90% of the solutions on EE!  Without them (in the true definition of the word) there wont be many answers... lol...

Why do you feel you need to access outside of your directory tree?

1.  File uploads to the server.
2.  Secure areas to store usernames and passwords.
3.  Database connection strings.

But funny thing is i get errors even when i try to access INSIDE the directory tree... just because of this setting - and because the entire web app is using basename / basedir functions for file locations.

Mystery continues...
0
 
LVL 3

Author Comment

by:NIPPLES
ID: 18893387
>>> LOL...wish I had refreshed before posting.  :)  That does change things.

Heheh... could do with some ajax in here...

Ok i give up - will have to email a modified php.ini to my sysadmin.  Thanks for the brainstorming guys..

Points go to first correct answer - "it cant be done" by glcummins.
0
 
LVL 24

Expert Comment

by:glcummins
ID: 18893391
The basedir restriction make your site think that it exists in it's own world, completely separate from anything else on the server. So, if your site files reside in the absolute path:

 /home/sites/yoursite/web

and you have a directory named:

 /home/sites/yoursite/web/includes/functions.php

you would access it using

 /includes/functions.php

Your application knows nothing about '/home/sites/yoursite', so trying to reference that location will throw an error, even if it is within your 'allowed' area.
0
 
LVL 3

Author Comment

by:NIPPLES
ID: 18893423
glcummins,

Thanks for your time!  

>>> Your application knows nothing about '/home/sites/yoursite', so trying to reference that location will throw an error, even if it is within your 'allowed' area.

Yep that makes sense... Its alot of hard coded php to eat through to fix.  ill just have to get  the guy out of bed and edit php.ini (so kind to try so hard to fix it first in EE huh?)

Cheers!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now