My notes and thoughts about Linux, WordPress, PHP and many more.
The usual and traditional way of editing website files is to download the file first using an FTP client (Filezilla for example). Once the file has been downloaded, it edited in your local computer and then once it is done, it is re-uploaded back to the hosting server using an FTP client and this is a time consuming process.
Therefore the best way is using SSH (secure shell) technology to edit files. One of the best SSH client that will let you edit PHP and HTML files online is pUTTY. SSH technology encrypts the packets as it travels through the Internet and lets you edit files online.
The procedure below requires your website server to support SSH. Please coordinate with your web hosting support to enable SSH, in case you are not familiar. To use Putty SSH to edit PHP and HTML files online:
Step1. Download Putty SSH client here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
This is for Windows OS 32 bit systems. Click putty.exe link as shown in the screenshot. And then download it to your Desktop.
Step2. Enter your SSH website information (you can get this from your web host)
Connection type: SSH
Then click “Open”
Step3. In the “Login as:” enter your SSH username, and then enter your password. You cannot see your password as you type it, so enter it carefully. Finally you are logged in when you see the Linux bash prompt:
login as: 291005 Using keyboard-interactive authentication. Password: -bash-2.06b$
Step4. To know the files and directory after you logged in: type ls, it will then give you the list of directories:
-bash-2.06b$ ls sys/ tmp/ www/
Step5. These are not yet your true website files, most web hosting companies placed these under “www” or “public_html” folder, so to access “www” folder, type cd www in the bash prompt and then type ls again to view the files and directories inside www folder.
-bash-2.05b$ cd www -bash-2.05b$ ls codexjoomla.php-developer.org/ dotnetdevelopment.net/ php-developer.org/
Step6. Based on the result above, there are three website folders inside www folder; since this is a shared hosting account. The folders belong to these following websites:
Step7. Supposing you need the index.php file of php-developer.org. You need to go inside to that folder first, using cd php-developer.org command, and then type ls to view again the files:
-bash-2.05b$ cd php-developer.org -bash-2.05b$ ls index.php* Linkrelnofollow.php* opensourceidcreator/ PHPXML-sitemap-generator.php* SP500historicaldataanalysis.php* postpdfcreator.php*
Step8. Since index.php is indeed inside php-developer.org folder, you will then launch the editor by typing:
-bash-2.05b$ pico index.php
PICO is a GNU editor. So after pressing enter; you will see the source code of index.php which you can then edit as you like.
To save changes after editing: Press Control – O and then when you see the message “File name to Write:” press Enter key
To exit the pico editor, Press Control – X
To exit the Putty SSH client: type exit in the bash prompt:
Not only you can edit PHP and HTML files but these can be used to edit other files also (such as robots.txt or even .htaccess)