Solved

Warning: Unknown(): open_basedir restriction in effect.

Posted on 2007-04-11
10
971 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
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…
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 …

778 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