Consider this scenario. You wrote some piece of code and placed it on remote server. Now you need to edit the source file. How you will do it ?
Here is the first approach -
- SSH into your server.
$ ssh username@ip-address- Navigate to the directory where your source file is placed
$ cd path-to-folder
$ vi file1.php
Second approach -
- Copy the file from remote server to your local machine.
$ scp username@ip-address:path-to-file- Edit the file using your favorite IDE/Editor. Save it.
- Upload the file back to the remote server.
$ scp path-of-file-at-local-machine username@ip-address
Third approach (Recommended for Large projects) :
- Open the netbeans IDE.
- Click on 'new project'
- Select 'PHP' from categories list.
- Select the 'PHP application from remote server' in Projects list. Click Next.
- On the 'Name and location' screen, write project name and click next.
- On the 'Remote connection' screen click on 'Manage' button.
- Enter the connection name and select the connection type as 'SFTP'. Click ok.
- A new screen will appear (see screenshot). Fill the details like IP address, Username and password. Port should be 22.
- In the 'Initial Directory field' type the absolute path of directory where your code is residing on remote server. It may be '/var/www' or soemthing like '/home/user/project'.
- After all the details are filled, click on the 'test connection' button. If everything is good then connection will be successful.
- In Project URL type http://localhost
- Make sure your upload directory is correct. This is where your code will be saved when you will press contr+s on your screen.
- Click next.
- Now on confirmation screen it will ask for the files to download from remote server. Check all if you want to download all the files.
- Right click on the project name in the left pane of IDE. Click on the properties menu entry. It will open the project properties window.
- Click on the 'Run Configuration' entry.
- In the main pane, see for text field 'Upload Files'. 'On Save' should be there. This means every time you save the files in your IDE they are updated at the remote server.
- Every time new file is created or deleted from IDE, same change is reflected at remote server. You can upload or download file explicitly by right clicking the source folder in project and then select 'upload' or 'download' option.
Now you need not to login to remote server every-time you need to update the files.
Good & Innovative Collection Admin :) :)
ReplyDeleteGreat!!!
ReplyDeletepretty basic stuff dude !!
ReplyDeleteThat is why blog name is "Newbie" :P
DeleteI wrote in context of "Newbie", means it's pretty basic even for Newbies :P
Deletenot that basic yar :) .
DeleteThis post is great!
ReplyDeleteBut the process is really slow..since I posted it, I have been trying download remote files to edit...its still downloading....after close to 2 hours!!!!
ReplyDelete