473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.php on
line 192

Warning: fopen("fileupload/Aleph One Log.txt", "r") - No such file or
directory in
/home/httpd/vhosts/mydomain.com/httpdocs/admin/uploadarticle.php 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.php on line
194

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

These are the lines of code:

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

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

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

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

anyone know what i've done wrong?
Jul 17 '05 #1
2 2616
*** 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.php 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.php 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
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...
7
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...
3
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:...
0
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...
0
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...
2
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...
6
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...
1
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.