Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning: open_basedir restriction in effect. File is in wrong director 1

Status
Not open for further replies.

Elliott3

Programmer
Joined
Sep 5, 2002
Messages
347
Location
CA
I cannot seem to figure out what the problem is here other than I am restricted. This is the error:
Warning: open_basedir restriction in effect. File is in wrong director...

What i do know is that safe_mode is OFF, but open_basedir IS set. The line that causes the error is:

include_once($this->PluginDir . "class.smtp.php");

This line runs fine on my local machine which also has safe_mode OFF but it does NOT have the open_basedir set. It is only when I run it on the server that I have the problem.

I have a temporary, but dirty fix. I just copied the class.smtp.php file into the top of its calling script(where the include_once() is located) and then comment out the include_once() line. Of course, this runs fine.

Any ideas as to how to fix the problem?

CES
 
The class.smtp.php file is in the same directory as other files that are use and do not have any issues. Have any idea why I may be having an issue with this one in particular?

I have even tried changing the include to:

include_once("class.smtp.php");
as both the calling script and the file i want to include are located in the same directory.

And ive also tried to use require_once() and a couple other methods instead of the above.

All suggestions welcome...i am willing to try anything even i it sounds silly..

CES




 
The value of open_basedir is:
/home/httpd/vhosts/jasonoffer.com/httpdocs:/tmp

CES

I do have other files in the same directory as class.smtp.php that open ok.
 
It would be below the first directory....this is the path:
...com/httpdocs/craig/research/Include/class.smtp.php

CES
 
What did you mean by 'PHP seems to disagree'? You don';t know what the problem is?

CES
 
What im saying is that i have several files in an 'include file. a.php b.php c.php d.php and class.smtp.php. files a b c d all work without a problem. the only difference between the files is that files a b c d all get called from other php files from outside the include folder. class.smtp.php gets called from d.php but when it tries to open the file, thats when i get the error message.

So this is my directory:
httpdocs
main.php
include
a.php
b.php
c.php
d.php
class.smtp.php

main.php calls all the other files except class.smtp.php without a problem. But d.php calls class.smtp.php and this is where i get the error. Even if i change the line from:

include_once($this->PluginDir . "class.smtp.php");
to
include_once("class.smtp.php");

any idea?

CES

i dont understand how it could not find the directory if it was anlready in that directory??
 
I had tried to change the file name to 'smtp.php' and changed accordingly in the calling script but i come up with the same error except of course the file name is changed. The only thing I have been able to get to work is just to copy the smtp file into the top of the other file and comment out the include statement. Its a dirty fix though and i never like to give up on a problem...they can always be solved.

CES
 
PHPmailer is very good. I and others in this forum have recommended it many times.


I don't know why you're having the problem. When d.php includes the last file, the path should be relative to the originally-invoked script. I don't know why you're getting that error if you do not with the others.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Thanks!
That is the problem. The script that calls 'class.smtp.php' is called by 'Include/class.phpmailer.php' so when i change the line to 'Include/class.smtp.php' it works. So I am having a problem with the function $this->PluginDir in the following line:

include_once($this->PluginDir . "class.smtp.php");

I would write the line as include_once($this->PluginDir . "class.smtp.php"); but it is called in other directories as well. Any idea what the problem with the function is?

CES

NOTE: I didn't realize that the path must be relative to the ORIGINALLY-invoked script!! Thanks!
 
The $this->PluginDir is part of the mailer class.
I just looked at it and it has nothing...i assumed that it was a function that got the relative directory...but it does not.

So whats happening is there are two mailer class files and the first one calls the second. Both are in an 'Include' folder. At one point the first class script gets called from one directory above the 'Include' folder and at another point the first class script gets called from one directory below. So $this->PluginDir couldn't be the same value for both. I guess I could copy the files into each of the two base directories but that is not much better than my original dirty solution of just having one class file.

Do you have a better suggestion?

CES
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top