Howto edit server files live remotely?

Hi,
Is it possible when coding a website to connect to files on a remote server from an editor on my own laptop?
I have been writting a bit of PHP, CSS, mySQL and now JS for a few months. I always edit live files. So either I use the hosting company’s GUI (Bluehost) or I ssh into the server and edit the files through emacs and use the command line.
But is their a way to open an editor on my own computer, which would connect to the server files and allow me to edit them live?
Thanks,
Shane

My approach is usually to download the file that needs changing with FileZilla, edit in Notepad++, then upload back to the live host.

For what I do, it doesn’t really matter if I muck it up, as it’s only for me. Common sense says you should really test offline first, before uploading it into the live environment.

3 Likes

Hi,
Thanks for your reply. I agree with you.
Since posting I have found that it is possible to ftp into your server using notepad++.
This makes it all so much easier. I glad I found this.
I have no doubt that this is basic knowledge for devs but new to me and really useful.
Thanks,
Shane

I too have edited “live” files on a remote server. Still I agree with chrisofarabia, you shouldn’t edit live files.
That said several editors and especially IDE’s such as Dreamweaver, Aptana Studio, Netbeans, Komodo Edit all offer the ability to connect to a remote serve to edit live files. This feature isn’t always readily apparent at first but a little digging and you should find the info needed to connect generally via ssh to a remote server.

The best practice probably would be to recreate your production server locally then use the local server for editing then upload when your sure it all works to your production server. Vagrant boxes are an excellent way along with Virtualbox to accomplish this. You can run these boxes in Windows, Linux and the Mac.

Steve

1 Like

I can usually get away with very minor edits, like a simple typo fix, for live files.

But for anything more than trivial be prepared to do some panic fixing if things crash on you.

1 Like

In my opinion, your workflow should be as follows…

Your local Dev environment is the “source of truth”. When your Prod code needs updating/fixing, then do it in Dev, and then upload the tested version to Prod.

If you start mucking with live Prod code, then your Dev is no longer the “source of truth”.

That simple.

3 Likes

Thanks for the posts.
Clearly it is best practice to work locally and then upload all to the prod.
If I create and test in Dev I will have to have databases set up on my machine (something I’d have to learn how to do!)
When I upload it all to Prod then I am not sure that everything will work on that system the same as it did on my Dev.
Thanks,
Shane

What I said for code between Dev and Prod goes for your database too.

On my local machine, I have a Dev database that is the “source of truth”, and when the Prod database needs updates/fixes then I do them in Dev, and then carry those changes over to Prod.

Because I have a smaller environment, I just upload mysqldump and bring over the entire database.

I guess it depends on your database size.

If you have questions about how to best handle this, I’d ask in the database forum…

1 Like

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