Author Topic: Proper TechniqueTo Edit PHP Files (Per Ken.)  (Read 4020 times)

G.C. Admin

  • Performance Based Hosting
  • Administrator
  • Hero Member
  • *****
  • Posts: 990
Proper TechniqueTo Edit PHP Files (Per Ken.)
« on: August 28, 2007, 04:40:47 PM »
A very good outline on the correct technique to edit PHP files.


FileZilla
One of the better ftp utilities, it's free and it's designed to work with php, html and other code languages. You can also use it to set/reset the write permissions on your files.
The only one I use.

Any time you do anything to your forum there is one thing that you should make part of your routine, like:

Backup... Backup... Backup!

When editing a file I generally do this;
Make a temp folder on my desktop...
open my site with my FTP utility...
download a copy of the file in question and place it in the temp folder...
then download a fresh copy into my editor and edit away...
go back to the site and rename the existing online copy of the file to something else, like, old_filename.php...
then upload the edited version of the file.
When doing several files I wait until all of them have been edited so that they can all be uploaded at the same time.

If everything is OK then I'm finished, if its all messed up I just delete the bad file that was uploaded, rename the good one and the forum is back to normal.
Frank Doud
Owner/Operator
G.C. Solutions

SunKing

  • G.C. Support
  • Jr. Member
  • ***
  • Posts: 24
    • Empire of the Sun
Re: Proper TechniqueTo Edit PHP Files (Per Ken.)
« Reply #1 on: February 26, 2010, 09:40:19 PM »
Some great points!

Let me add to them with some of my own points. These days, most FTP programs allow editing directly on the server without the necessity to download, edit, then upload. This can, however, have dire consequences if you don't first backup, backup, backup. For my backups when editing directly on the server, I open the file in question, make my edits, and then save without closing the editor. This way, if there are errors, I can simply click undo in the editor and hit save again. I found that doing it this way really saves a lot of extra time that would otherwise be taken up by constant downloading and uploading of files.
Also, right-clicking on a file located on the server (typically, the right column of the FTP program) will bring up a dialog in which can be found the option to "chmod" your files and folders (change the read/write permissions).