Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm not sure this is the right place to ask this question, but here goes.

I have a website on a shared hosting linux server. In an ideal world I would make all changes to it offline in a version controlled environment and then upload these changes when perfected. Although I do this with major changes, this does not happen for small changes and without downloading every file and inputting into VCS before changing and uploading it is not simple to ensure version control of the live files. I dont have SSH access and I dont really want to have to change providers.

I am wondering if there is a web only Version Control solution that will work on a shared web server with no further permissions other than those required to run a php site? I can run perl scripts and thought about using fossil, but it seems you can only run the UI and cant run other commands.

Is there a php VC system? Can I run git commands on a shared hosting platform via a php/perl script?

Basically what I want to be able to do is make changes to my site live and then when finished my changes call a php or perl url and have the changes commited to a version control repository.

PS. I know editing a live site is not a clever thing to do, but I'm still interested in a solution to my problem.

share|improve this question

5 Answers

I have never tried doing this on a live web site, but you can use the Unix utility wget to mirror a web site. You'll probably need to experiment to get the command line switches right, although the -mirror option is suggestive. You might also need to jump through some other hoops if you have files stored outside the web server's document root.

What's that look like?

  • Create a repository using whatever VCS.
  • Download the web site using wget.
  • Commit the downloaded files as a new project to the VCS.
  • Test.
  • Make changes to the live web site.
  • Download only changed files using wget.
  • Commit the changes.
  • Test.

It's a little backward from what I'm used to, and the risks are obvious, but if that's what you want to do, wget might take you a long way down the road.

share|improve this answer
+1, fixing the workflow and using the right tool is the correct call here. – Wyatt Barnett May 8 '11 at 19:22
Ummm ... if the OP's site is PHP scripts then wget will get the output produced by PHP, not the actual PHP, and there's probably not much point versioning that. – James May 8 '11 at 23:45
wget supports ftp. – Mike Sherrill 'Catcall' May 9 '11 at 0:03

Have you checked these out? I think they are mostly for viewing rather than committing, but some might be able to do both.

share|improve this answer
Would be a better answer if you listed what these are in your answer. Thanks I'll check them out. – Toby Allen May 18 '11 at 14:16

We have a duplicate setup site behind the firewall that is copied to the live location using a shell script that is run on a schedule. The backup code is updated and then copied to the live site using a cron job. The backup is fully operational and at the same time is keyed through source control.

share|improve this answer

Thanks for the answers so far.

I found 'A Simple Version Control System' which is a php based VCS that will track the files on the site its installed on. Just what I want really. Its fairly basic but should allow me the confidence of being able to feel I have a backup if I need it.

share|improve this answer

So many good code editors allow you to have a local dev or test environment and then synch to a live server using FTP. They only upload the files you change, and they give good visual indicators of the differences between the test and the live sites.

With virtual machines and the ability to reproduce your dev environment locally, there's really no real reason to have to develop on the live site anymore.

share|improve this answer
Thanks Amy, but I'm afraid that doesnt answer my question, and I believe you are correct, but it doesnt work for me. – Toby Allen May 18 '11 at 14:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.