Solved

Warning: Unknown(): open_basedir restriction in effect.

Posted on 2007-04-11
10
976 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

726 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