I have a script on my one server and I want that script to create a file on another server of mine using PHP, NOT VIA FTP?

Comments

What servers are those? What platform?

Written by Pekka

Both are Centos

Written by Roland

Accepted Answer

There are many ways to do this. I'd pick the first one myself because it's easiest to set up:

  • If you have PHP+Apache on another server, just call some script on the other server using file_get_contents with http URL as filename or use cURL if you need to POST file contents as well.
  • If the servers are in same network (LAN, VPN) you can use Windows shares/Samba or NFS to mount a remote directory to you local filesystem and simply write to file directly using fopen/fwrite functions
  • Use SSH via SCP or SFTP
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki