I'm trying to read and write a file in a remote server but I can only check if it exists:
<?php
echo 'test';
set_include_path('/mnt/vpn');
$dst = "/mnt/vpn";
echo $dst, file_exists($dst) ? ' exists' : ' does not exist', "<br><br>";
echo $dst, is_readable($dst) ? ' is readable' : ' is NOT readable', "<br><br>";
echo $dst, is_writable($dst) ? ' is writable' : ' is NOT writable', "<br><br>";
$fh = fopen($dst, 'r',1);
if ( !$fh ) {
echo ' last error: ';
var_dump(error_get_last());
} else {
echo $fh;
}
?>
this is the error log:
test/mnt/vpn exists
/mnt/vpn is NOT readable
/mnt/vpn is NOT writable
Warning: fopen(/mnt/vpn): failed to open stream: Permission denied in /var/www/html/test.php on line 11
last error: array(4) { ["type"]=> int(2) ["message"]=> string(57) "fopen(/mnt/vpn): failed to open stream: Permission denied" ["file"]=> string(22) "/var/www/html/test.php" ["line"]=> int(11) }
when I try to do the same with a local path it works
I'm using WinSCP