Editing Remote PHP Project Using Netbeans
Tags: code, git, netbeans, php
Published: 2019-06-25 16:48:50

---
title: Editing Remote PHP Project Using Netbeans
published: true
tags: code,git,netbeans,php
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/853/1*JbzJWaEsSx1g3HaKeAgTmQ.jpeg)

Consider this scenario. You wrote some piece of code and placed it on a 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_

- Edit the code using vi/emac/nano editor. Save it. Exit.

> _$ vi file1.php_

Second approach -

- Copy the file from the 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_

The third approach (Recommended for Large projects) :

Open the Netbeans IDE. Click on ‘new project’  
Select ‘PHP’ from the categories list.  
Select the ‘PHP application from remote server’ in the Projects list. Click Next.

![](https://cdn-images-1.medium.com/max/640/1*6Fgh9esApolAgO_h4Wd7yg.png)

On the ‘Name and location’ screen, write project name and click next.

![](https://cdn-images-1.medium.com/max/640/1*qPypEW3ATPfDJ41a7p-Czg.png)

On the ‘Remote connection’ screen click on the ‘Manage’ button.  
Enter the connection name and select the connection type as ‘SFTP’. Click ok.

![](https://cdn-images-1.medium.com/max/384/1*Zvu3kLvhR9KGHqawhrA16Q.png)

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 the directory where your code is residing on the remote server. It may be ‘/var/www’ or something like ‘/home/user/project’.

![](https://cdn-images-1.medium.com/max/608/1*HsvSNE8aMtqvdmTSXo-X5w.png)

After all the details are filled, click on the ‘test connection’ button. If everything is good then the connection will be successful.

![](https://cdn-images-1.medium.com/max/254/1*1WF4_CxDF-_fLXmvt4Edjg.png)

In Project URL type [http://localhost](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 the confirmation screen, it will ask for the files to download from the remote server. Check all if you want to download all the files.

![](https://cdn-images-1.medium.com/max/640/1*-oOKuthI012PicXHKLNYlg.png)

On clicking the finish button, it will download all the files from the remote server to the local server. It may take some time depending on the size of the project.

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.

![](https://cdn-images-1.medium.com/max/171/1*6Yyf7Cfod7nkBAfdvkObTw.png)

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.

![](https://cdn-images-1.medium.com/max/400/1*fdqDurUOuL6KiKMHk5FGkg.png)

Every time a new file is created or deleted from IDE, the same change is reflected at the remote server. You can upload or download file explicitly by right-clicking the source folder in the 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.

**More from the Author:**

- [**How to host Django app on pythonanywhere server for free**](https://www.pythoncircle.com/post/18/how-to-host-django-app-on-pythonanywhere-for-free/)
- [**How to send email from Python and Django using Office 365**](https://www.pythoncircle.com/post/36/how-to-send-email-from-python-and-django-using-office-365/)
- [**How to use AJAX with Django**](https://www.pythoncircle.com/post/130/how-to-use-ajax-with-django/)
- [**Python Script 2: Crawling all emails from a website**](https://www.pythoncircle.com/post/217/python-script-2-crawling-all-emails-from-a-website/)
- [**How to create a completely automated telegram channel with python**](https://www.pythoncircle.com/post/265/how-to-create-completely-automated-telegram-channel-with-python/)
- [**Get latest Bitcoin and other crypto-currencies rates using python Django**](https://www.pythoncircle.com/post/394/get-latest-bitcoin-and-other-crypto-currencies-rates-using-python-django/)