How to make Notepad++ run the PHP file on the server that I set?

TheAmazingKnight picture TheAmazingKnight · Nov 12, 2013 · Viewed 53.4k times · Source

It is my first time touching on php and I'm learning the basics of it. I've used Notepad++ for all of my HTML, CSS, and javascript files. Since, theses three are able to test and run locally, php isnt because it's a server side which requires a server to run. I was wondering, if there's a way to make Notepad++ run the file on the server?

In the Notepadd++ title header, it gives the local directory "C:\Users\Jaime\Desktop\grade.php" of my file, but can this directory be altered to something like "http://" indicating it's being tested and run on the internet?

If not, is there anything else I can use to efficiently run php files without having to refresh and put the files in Filezilla to see the changes made?

Thanks!

Answer

Dan Hlavenka picture Dan Hlavenka · Nov 12, 2013

These answers so far deal with either running PHP locally or synchronizing with a server (which it seems like you were already doing), but none seem to address actually executing the PHP script from Notepad++, which I think was your main question. I'm not an expert on Notepad++ by any means, but here's what I came up with:

  1. Go to Run -> Run...
  2. Type in firefox "http://yourserver.com/$(FILE_NAME)"
  3. Hit "Save..."
  4. Type in a name like "Run on Server"
  5. Pick a keyboard shortcut
  6. Hit OK, then Cancel

Replace "yourserver.com" with the URL to your web server. This shortcut should launch Firefox and point it at http://yourserver.com/YourCurrentFile.php, assuming the file you were editing was something like C:\Users\TheAmazingKnight\Desktop\PHP\YourCurrentFile.php. It's not a perfect solution, but you should be able to tweak it to your needs.