$username_ftp = "user";
$password_ftp = "password";
$file_name = "remote-transfer.txt";
$url = "example.biz/test/" . $file_name;
$hostname = "ftp://$username_ftp:$password_ftp@$url";
$content = file_get_contents('index.html');
$options = array('ftp' => array('overwrite' => true));
$stream = stream_context_create($options);
file_put_contents($hostname, $content, 0, $stream);
I try to put a file from my remote remote server to another remote server while I exixute this code from my localhost this is a working file, and I transfer the file from my ocal PC to the server. But when I try to output this code from my AWS server, it does not transfer any files. When I check my error log file, it gives
PHP Warning: file_put_contents(): connect() failed: Permission denied
PHP Warning: file_put_contents(ftp://...@example.biz/remote-transfer.txt): failed to open stream: operation failed in
My test resolution for folder 777 is
now what to do if there is any server configuration that is missing.
source
share