Solved

Warning: Unknown(): open_basedir restriction in effect.

Posted on 2007-04-11
10
981 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 51

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
 
LVL 51

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

724 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