Copy htdocs from one sub domain to another

**My website URL is:**www.tastytracker.com

What I’m seeing is: I would like to copy the contents of htdocs from my free website optiontracker.epizy.com to my prod domain htdocs (listed above). They are both on the same account so using a ftp and an external script I could code it up, but I thought it would be nice to use cron and php. However, I believe php can only reach the htdocs of the current site its running under, even if they are technically the same account.

I’m using this software: This would be php and cron

Additional information:

So to be clear,

  1. Can this be done in php?
  2. If not can I do it any other way in cron?
  3. If not is there another solution? Or is the only option an ftp script that runs on an external server, and does all the ftp work, between the two essentially sub directories?

I see your websites have the same contents, so I expected you would copy the files and folders from the htdocs to yourdomain/htdocs via an FTP client.

You could call PHP through Cron and use FTP from the PHP code to upload the files to the other directory over FTP.

Can it be done? Probably. Should you? Probably not. The cron implementation is a bit… basic and script execution limits are going to make this very hard. Running a shell script somewhere else is probably easier.

I found a pretty cool project sibbl / Bitbucket FTP deployment / wiki / Home — Bitbucket to use a webhook on push to git, but the only issue is that its working with bitbucket 1.0 api. If I have time ill port it to their api 2.0 but I was really just looking for a quick and dirty deploy from test to prod on some trigger either nightly or on check in or something. I think I can still stay under that limit if I only upload the files that have changed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.