简体   繁体   中英

PHP and Netbeans - working with sftp or svn for remote sources


Two scenarios for you guys:

1:
I use Netbeans with the built in sftp. I will get a copy of the remote source to my computer, and edit that. Netbeans will keep my local copy and the remote source in sync.

2:
I use svn. Checkout the remote source. Open a local project in netbeans. When I want to see my changes, I have to first commit, then with ssh from the server do update, and then open my browser and see the changes. Tedious.

I want to go for the first scenario. It's not the production-environment. And currently I'm the only one working on this project. But one day I get a colleague helping me out, just doing a QA or fixing one simple bug for me and sftp directly to the development-environment is not cool if I want to work as he is helping me out or whatever...

Anyone been in the same situation? I'm sure there's some other way that I haven't discovered yet ;)

I use a combination of the two scenarios, SFTP to update the remote source on the server and SVN to just keep track of changes and history so that if I mess something up I can roll back. NetBeans supports both, when you create a PHP project through the wizard you'll get to the 3rd page that says Run Configuration of the Project creation page select Remote Web Site (FTP, SFTP), it will then allow you to change your settings to match those of your server and you can change Upload Files from on Run to on Save so that whenever you save a file it is automatically uploaded to the server.

For SVN after your project is created just right click on the project name and select "Team" from the menu and then import into SVN import the project into a SVN repo, if it's already in a SVN repo you can use the Team menu from the menu bar up top and select check out to create a project from the source and have it automatically under SVN control, then you can just right click on the project name and change the Run Configuration to set the project to upload to the remote server on Save/Run etc....

Hope that helps.

First, you have to use a versionning system. So I think you are going to use SVN anyway.

The best thing you can do, imho, is to add a hook to SVN saying that when you commit, update the test server . Now, to see changes on the test server, you just have to commit your work.

However, I woudn't recommend to do that on a production server, because is it better to check that your stuff is working before deploying it. Also, it creates a tendency to commit les often, which is bery bad.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM