I am getting the error
Warning: fopen() [function.fopen]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (VIRTUAL_DOCUMENT_ROOT:/tmp/) in /www/elitno.net/s/p/anger2/home/site/classWebPage.php on line 83
My phpinfo file is here -> http://spaceranger2.elitno.net/phpinfo.php
The line where the error is occuring is here:
function openLink(){
$this->fp = fopen($this->URL, "rb");
array_shift($http_response_header);
$this->headers = $http_response_header;
}
I only have access to .htaccess but not my php.ini file; i tried using this
open_basedir = "VIRTUAL_DOCUMENT_ROOT:/tmp/:/www/elitno.net/s/p/ranger2/home/site/"
but this generates 500 internal error‘s, any suggestions?
Generally
fopenis only allowed to open files to which the user running the script has access.You have designed your function
openLink()to actually open a particular URL. You should note that when usingfopenit actually indicates opening a file on the disk. If you pass values like/or/filename.txtit is actually going to try and open the file on the disk at that absolute filesystem path.From your question data you are telling
fopento open/. That’s the root of the filesystem of the server. Your user definitely won’t have access to it (and hence the error you see).If you want to open a relative path to your website consider prefixing the site URL to the
$this->URLvariable before passing it tofopento indicate that you are trying to open a URL.You can do something on the following lines: