Jump to content

[SOLVED] Warning: include(xx) [function.include]: failed to open stream errors?


wmguk

Recommended Posts

I get these errors, when accessing a page on an HTTPS server,

 

Warning: include(create.php?login=drewtest) [function.include]: failed to open stream: No such file or directory in /var/www/vhosts/domain.co.uk/httpsdocs/createadmin/uploadim.php on line 10

 

Warning: include() [function.include]: Failed opening 'create.php?login=drewtest' for inclusion (include_path='.:.:') in /var/www/vhosts/domain.co.uk/httpsdocs/createadmin/uploadim.php on line 10

 

this is line 1 to 10

 

<?php
session_start(); 
if (!isset($_SESSION['myusername'])) {
    header("location:index.php");
    exit; } 
$user = $_SESSION['myusername'];
$login = $_POST['login'];
include "../scripts/connection.php";
include "../scripts/ftpaccess.php";
include "create.php?login=$login" ;
?>

 

this is the line affected : include "create.php?login=$login" ;

 

however the create.php is in that same directory :( cant you pass a variable via an include?

I don't think you can pass get variables via include. If you need to set the get vars you could try this:

<?php
$_GET['login'] = 'login';
include(create.php);
?>

 

wow, ok yh I did wonder if you could pass the vars...

 

now i get this error:

 

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/var/www/vhosts/domain.co.uk/httpdocs/clients/login) is not within the allowed path(s): (/var/www/vhosts/domain.co.uk/httpsdocs:/tmp) /var/www/vhosts/domain.co.uk/httpsdocs/createadmin/create.php on line 8

 

Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/var/www/vhosts/domain.co.uk/httpdocs/clients/login) is not within the allowed path(s): (/var/www/vhosts/domain.co.uk/httpsdocs:/tmp) in /var/www/vhosts/domain.co.uk/httpsdocs/createadmin/create.php on line 11

 

Failed to create directory...

Contact Drew

 

Warning: copy() [function.copy]: open_basedir restriction in effect. File(/var/www/vhosts/domain.co.uk/httpdocs/clients/getpics.php) is not within the allowed path(s): (/var/www/vhosts/domain.co.uk/httpsdocs:/tmp) in /var/www/vhosts/domain.co.uk/httpsdocs/createadmin/create.php on line 20

I've never really looked into is_dir and similar, but it sounds as though you don't have permission to access that folder through those functions or that you're using direct urls when you should be using relative. Something like that.

Could you post the code please?

excellent, I have just removed the open_basedir restriction between the http and https so now I dont get any errors between the two systems, however I now get:

 

Warning: copy(/var/www/vhosts/domain.co.uk/httpdocs/clients/login/getpics.php) [function.copy]: failed to open stream: Permission denied in /var/www/vhosts/domain.co.uk/httpsdocs/createadmin/create.php on line 20

 

hmmm, permission denied implies that the chmod still didnt work...

 

this is the code:

<?php
$thisdir = "/var/www/vhosts/domain.co.uk/httpdocs/clients";
$login = $_GET['login'];

$getpics = "/var/www/vhosts/domain.co.uk/httpdocs/clients/getpics.php";
$newdir = "/var/www/vhosts/domain.co.uk/httpdocs/clients/$login/getpics.php";

if (is_dir($thisdir ."/$login") )
  exit();

if(mkdir($thisdir ."/$login" , 0755, true))
{
chmod($thisdir ."/$login", 4755);
}
else
{
   echo "<p class='footer'>Failed to create directory... <br> Contact <a href='mailto:[email protected]'>Drew</a></p>";
} 

echo copy("$getpics", "$newdir"); //This is the line 20 with the issue

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.