tags:

views:

774

answers:

12

So I am just starting out developing PHP web applications and have finished setting up my server with the following:

  • Ubuntu Server
  • Apache2
  • PHP
  • MySQL
  • VSFTPD
  • and all the other goodies...

Currently when I edit files, I have two methods to update/upload them to the server. I can use vi on the server to make small changes or I can use NetBeans 6.5 RC2 and then use VSFTPD to upload them to my home directory and 'mv' the file to the proper location (/var/www).

My questions: What method should I use to edit PHP and upload them to the server? Is NetBeans ideal? Does vi really have as few features as I've found (basic text editor commands with no PHP IDE functions). What am I missing? From the amount of material I've discovered just as I've begun to write a PHP application, I know there must be a better solution but haven't found one yet.

(Note: I have meddled around in setting chroot_local_user=NO but realized that if I upload something that ends up breaking my site I have no backup copy.)

+9  A: 

I don't like very much the idea about making changes directly on the server, I can recommend you another approach: Use a version control system, there you check in all the changes that you do to your code, then you can easily checkout or export all the modifications when you deploy, and in that way you'll have the complete history about all the changes that have been done on each file, you can have full control of your code...

I use Subversion, and it is very easy to deploy your versioned source code to the production server...

CMS
"Directly on the server" doesn't have to mean production. You can have a live dev environment set up on the server. I used to do this a lot, before using version control (since it doesn't really work with multiple people, unless you give each their own dev environment)
gregmac
A: 

I use Zend Studio. I get the benefit of the IDE on my local machine (Linux/Mac/Win), and when I save it saves remotely on the server. It's kind of like the old HomeSite with some features (code completion, etc..) specific to PHP. I believe it will also work with version control, but since I'm one guy working alone I don't use it.

Tim
A: 

On the Mac I use:

CyberDuck (free) as the automatic ftp program TextMate ($51) as the text editor

When you save in TextMate CyberDuck will automatically upload to the server.

Note, however, that you should not be editing your live code. I have a live deployment and then a separate development environment on the server. I make my changes in the development environment, test, and then have a script that archives the current deployed version and then copies over the development environment when I want to deploy.

Garth
A: 

I don't have need for staged deployment, as my web sites are pretty simple .. Therefore, I use WebDrive .. map the remote server to a drive letter and edit files using Notepad++ (usually) . And then I use Bazaar to manage change history

Scott Evernden
+1  A: 

Using Notepad has to be the worst of any possible option I can think of. That hasn't been cool since ~1996. (no offense intended) :)

Tim
A: 

PsPad is a local Windows based code editor with all the bells and whistles, plus it also allows remote FTP folders to be configured to work the same as "local" folders - so you can open a "remote" folder, edit a file then save it ... and it's saved on the remote server.

Very handy. :-)

I also heartily reccomend a code repository like SubVersion or CVS as well, using TortoiseSVN or TortoiseCVS to enable access to the repository commands makes them show up inside the PsPad editor file tree as well.

Ron

Ron Savage
+5  A: 

You can basically use anything that has the feature set you want. Here are but a few options:

You need to decide what set of features you want, and which editor you are more comfortable with.

VI is very feature rich, but it has a steep learning curve. Read up(PDF) on it, and try it again.

Personally I use Anjuta, as I dont use / like all of the functionality of the full IDE's. I sometimes use gedit if I want to quickly edit something, or VI if I'm in a terminal and want do to something.

And like source control is a very good idea!

Jrgns
A: 

For a real setup, I would at least recommend having one or more dev-server(s) (One per developer), a central repository, and a production server. Both the production server and the dev server(s) have a working copy checked out from the repository. You can extend on this setup, but it's a good baseline.

You can have you dev server at the machine which you use to work on, or you can remote in to it. If you do the latter, you may want to use ssh to get shell access on the dev server, and combine it with sshfs to allow you to easily edit files on the remote server as if they were local. If you're stuck on Windows at the client, you will have to use other tools, such as WebDrive.

troelskn
+1  A: 

Forgive me, I know it's wrong, but I do this all the time.

To answer the question, I use jedit with the ftp plugin.

Michelle
A: 

You can also use Komodo Edit to edit files remotely. Use the "File->Open->Remote File" option. You can edit files over FTP, FTPS, SFTP, SCP.

Robert Smith
A: 

I use subversion as another commenter said, but I use to use WinSCP on Windows to connect via SSH2 on the remote server.

WinSCP has an auto-synchronize option where as soon as a file changes on your local machine, it is uploaded to the server. That's great for uploading changes as you work on them for testing.

Of course it also has a traditional synchronize that will push your local files (and subfolders) to the server.

Chris Thompson
A: 

i've been using Zend Studio for a while now but tonight I shifted to Komodo.

Zend has inbuilt remote folder integration, but it doesn't always work. Sometimes it hangs, and you're left with a half uploaded file and a broken site. Sometimes it just stops saving to the server, and without an alert, it keeps saving but just to the local cache. I've saved files this way and thought it was all done, closed zend, lost the cached file and only realised after that it didn't actually save.

While the above is a fault of my method more than the program, e.g not using cvs or subversion, not all sites are worthy of cvs or subversion configuration. A simple remote ftp edit and save to server is fundamental web development the www was built on. I'm surprised how few so called "IDE" suggest they are internet development environments when most of them have ignored this way of web dev.

Komodo has a plugin you need to actually add on even before you can access remote folders in a way that allows simple browsing, point and click, edit and save functionality. By default Komodo (without the plugin http://community.activestate.com/xpi/remote-drive-tree) it only has room for adding a remote 'file'. Just one file. How convenient and timely to add a singular file to work on

So if you go Komodo, grab that plugin otherwise you'll be scratching your head wondering why you can add a file, but not a remote folder to work on.

cosmicbdog