Use NetBeans to Work with Yii in VM


Because my NetBeans is on the host while the development environment is in the guest, I need to treat Yii Framework in TurnKey Linux in virtual machine as a remote server. Here is how to make them work together.

Create a Project with Remote Server

Launch wizard from [File]→[New Project…] in your NetBeans.

Step 1, choose [PHP Application from Remote Server].

Step 2, fill in developer information including project name,  PHP version, encoding, and directory to keep metadata. Don’t use space in project name because it is not valid url in next step.

Step 3, use the virtual machine IP address as url. You will need to manually create a new [Remote Connection] by pressing [Manage] to add a new one. TurnKey Linux has build-in SFTP service enabled. Test connection before apply. If you are using building web application, change [Upload Directory] to yiiframework. Make sure the generated SFTP command access the right directory.

Step 4, choose files and folders to be included in project.

Work with Save

Every time you save a file in the project, NetBeans will upload automatically to replace the old version file on server.

About last file properties, it will use virtual machine date information and the account used in remote connection. You may follow Setup Time Zone and Sync with a NTP Server in TurnKey Linux to make sure your host and guest environment are on the same time zone.

Synchronization

On the [Source Files] in Projects windows, right click to [Synchronize…]. It will compare files on both sides and show your a list with suggestion. Double click on any of them will bring you file contents and compare side by side.

Without Setup Time Zone and Sync with a NTP Server in TurnKey Linux, you might always upload or download from virtual machine. If you have open files in NetBeans, I suggest you to [Save All] before syncing or there would be conflicts need to be solved manually.

If files on virtual machine are newer than those opened in NetBeans and you click to sync, opened files will be replace.

Other Thoughts

Please be very careful when you want to sync between host and guest. I still preferred to close all open files and make a copy of the directory in host before synchronization.

In Oracle: NetBeans for PHP: Blogs: Remote synchronization, Thomas writes:

Please notice that the remote synchronization works better only on the whole project (it means that the Source Files must be selected). The Synchronize action is also available on individual files (more files can be selected at once) but the suggested operation (download, upload etc.) does not work so precisely. Also please notice that the suggested operations are not 100% reliable since the timestamps provided by FTP servers are not exact.

Reference

  1. NetBeans
  2. NetBeans: Docs & Support: Deploying a PHP Application on a Remote Web Server Using the NetBeans IDE
  3. Oracle: NetBeans for PHP: Blogs: Remote synchronization
  4. PHP.net
  5. Setup Time Zone and Sync with a NTP Server in TurnKey Linux
  6. TurnKey Linux
  7. TurnKey Linux: Yii Framework
  8. Wiki: IP address
  9. Wiki: SSH File Transfer Protocol
  10. Wiki: Uniform resource locator
  11. Wiki: Virtual machine
  12. Yii Framework
  13. ZurmoCRM

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.