473,651 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open_basedir restriction in effect

I recently reconfigured open_basedir so that it wasn't quite so limited.
Now, I'm getting erros with php script that use to run fine, and I can't
figure out what went wrong.

Previously, open_basedir was configured (locally) like so:
/home/httpd/vhosts/mydomain.com/httpdocs/:tmp/

I changed it to
/home/httpd/vhosts/

Now I get the following errors:

Warning: open_basedir restriction in effect. File is in wrong directory
in /home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.p hp on
line 192

Warning: fopen("fileuplo ad/Aleph One Log.txt", "r") - No such file or
directory in
/home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.p hp on line
193

Warning: stat failed for fileupload/Aleph One Log.txt (errno=2 - No such
file or directory) in
/home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.p hp on line
194

Warning: fread(): supplied argument is not a valid File-Handle resource
in /home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.p hp on
line 195

These are the lines of code:

192 copy ($_FILES['quarkfile']['tmp_name'],
"fileupload/".$_FILES['quarkfile']['name']);

193 $open=
fopen("fileuplo ad/".$_FILES['quarkfile']['name'], r);

194 $filesize =
filesize("fileu pload/".$_FILES['quarkfile']['name']);

195 $wholefile = fread( $open, $filesize );

anyone know what i've done wrong?
Jul 17 '05 #1
2 2632
*** Brandons of mass destruction escribió/wrote (Sat, 12 Mar 2005 22:23:44
-0500):
Warning: open_basedir restriction in effect. File is in wrong directory
in /home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.p hp on
line 192


Assuming your paths are correct and you are accessing files within the
allowed tree, I can tell you I've often found this error when using
relative paths in the include constructs. Perhaps PHP searches for the file
in the include_path list of directories, which may be outside the tree
(anyway, I didn't have time for proper testing so I can't tell you if this
is actually the reason). There are probably better solutions but using full
paths definitively solves the problem. The variable
$_SERVER['DOCUMENT_ROOT'] can be helpful.
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Jul 17 '05 #2
In article <yp************ *************** **@40tude.net>,
"Alvaro G. Vicario" <kA************ *****@terra.es> wrote:
*** Brandons of mass destruction escribió/wrote (Sat, 12 Mar 2005 22:23:44
-0500):
Warning: open_basedir restriction in effect. File is in wrong directory
in /home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.p hp on
line 192


Assuming your paths are correct and you are accessing files within the
allowed tree, I can tell you I've often found this error when using
relative paths in the include constructs. Perhaps PHP searches for the file
in the include_path list of directories, which may be outside the tree
(anyway, I didn't have time for proper testing so I can't tell you if this
is actually the reason). There are probably better solutions but using full
paths definitively solves the problem. The variable
$_SERVER['DOCUMENT_ROOT'] can be helpful.


Figured it out, had to change my temp folder to something else (a
previous programmer had set this script up) and change the permissions
on the temp folder to make it writable.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2089
by: Felix Natter | last post by:
hi, I read the section about open_basedir in the safe_mode documentation (http://de3.php.net/features.safe-mode) but this only confirmed my understanding of open_basedir and didn't help understand the problem below. I tried to search the net, but couldn't find anything yet. here is my test-case (with php_admin_value open_basedir /home/m2004001):
7
20784
by: Paul | last post by:
Hi Im testing a script to see if it works in different situations and open_basedir is one of them. However if i turn it On all i get is errors Warning: Unknown(): open_basedir restriction in effect. File(c:\web\httpdocs\session.php) is not within the allowed path(s): (1) in Unknown on line 0 Warning: Unknown(c:\web\httpdocs\session.php): failed to open stream:
3
4629
by: Alvaro G Vicario | last post by:
This is the open_basedir restriction of my site: php_admin_value open_basedir /tmp/:/home/site/ All my PHP files are under /home/site/htdocs. However, I get lots of errors like: Warning: open_basedir restriction in effect. File is in wrong directory in /home/site/.......
0
2346
by: jeff.battle | last post by:
I'm trying to get PEAR DB to work on my machine at serverbeach but I'm getting the following error: Warning: main(): open_basedir restriction in effect. File(/usr/share/pear/DB.php) is not within the allowed path(s): (/home/httpd/vhosts/adapttosolve.com/httpdocs:/tmp) in... phpinfo() says I have the following open_basedir values set: open_basedir | /home/httpd/vhosts/adapttosolve.com/httpdocs:/tmp | no value
0
2481
by: erwinschrijver | last post by:
On a previous installed server my site which uses several PEAR-packages worked fine. Now it's transfered to a new server. (Both servers installed with Windows 2003 / IIS 6, on the previous server the PHP version was 5.03, on the new one 5.05) The site gives a open_basedir restriction on this new server. In the php.ini the open_basedir line is commented, but when I run the command phpinfo() there appears to be a local value, which I...
2
3001
by: sreniaw | last post by:
Hello, I use php 5.1.4 with apache 2.2.2 on Solaris 10. The problem is that I can't configure open_basedir because I always get warming message: Warning: readfile() : open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/wwwroot/default) in /wwwroot/default/mk.php on line 3 Warning: readfile(test.txt) : failed to open stream: Not owner in /wwwroot/default/mk.php on line 3
6
15045
by: lawrence k | last post by:
If I ssh to my server and look at the php.ini file, it apears that open_basedir is off: ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per- directory ; or per-virtualhost web server configuration file. This directive is ; *NOT* affected by whether Safe Mode is turned On or Off. ;open_basedir =
1
4647
by: Markus | last post by:
Hi My ISP seems to have made a PHP version upgrade - without any change in the code, a new error occurs: PHP Warning: ftp_nlist() : open_basedir restriction in effect. File(/var/tmp/) is not within the allowed path(s): (/data/htdocs/domain.com/:/usr/local/share/pear/:/tmp/:/var/tmp/) in ... I have found some bugs related to open_basedir and temp directory
2
839
by: rdlowrey | last post by:
Okay, I've tried a bunch of things on this one and can't figure it out. The line in my phpinfo: open_basedir /var/www/vhosts/mysite.com/subdomains/intranet/httpdocs:/ tmp no value Why would I get a "Warning: move_uploaded_file(): open_basedir restriction in effect." error message if I've used SSH to set the Master open_basedir value to "no value" (as evidenced by phpinfo)?
0
8347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8792
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8571
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7294
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.