2

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!

TheAmazingKnight
  • 2,442
  • 9
  • 49
  • 77
  • possible duplicate of [Is it possible to run .php files on my local computer?](http://stackoverflow.com/questions/9318858/is-it-possible-to-run-php-files-on-my-local-computer) – mario Nov 12 '13 at 04:10
  • possible duplicate of [PHP IDE for Search in remote file without store the files to local](http://stackoverflow.com/q/15104132) – mario Nov 12 '13 at 04:11
  • @mario those 2 are not related! TheAmazingKnight I would advise you to remove any references to PHP because it is irrelevant and confused people. Your question is about **Notepad++ being able or not to execute a script (PHP, Python, Perl, whatever) that's not stored locally**. – psxls Nov 12 '13 at 05:54

4 Answers4

6

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.

Dan Hlavenka
  • 3,697
  • 8
  • 42
  • 60
2

What you probably need is an FTP Synchronize plugin that will allow you to edit a copy of your php file and then synchronize it to the server.

How to Install:

  1. Make sure that your Notepad++ is closed

  2. Download from this link . I choose version 0.9.6.1. Unpack or Unzip to \Notepad++\plugin folder.

  3. It will have its own folder so copy or cut and paste the files to \Notepad++\plugin

  4. Read the file named "What file to use" so that you will know which to use. In my case I used FTP_synchronize.dll

  5. Run your Notepad++ and it will tell you that it will remove the unwanted files and just click Ok for it.

  6. Go to Plugin-->FTP Synchronize-->Show FTP Folders. And presto there you have it!

How to Connect:

Go to menu Plugins-->FTP Synchronize-->Show FTP Folders

Go to Menu Plugin

Click Open Settings Dialog

enter image description here

Click the New Button then type-in the Address, Port, Username, Password and check Active on Connection Mode. And finally Click OK.

enter image description here

Click Connect

enter image description here

Click upload Current File to Folder

enter image description here

Then check your website and in my case the files uploaded are on the login name that I used that turned into a folder. And inside the folder are the files that I uploaded. Or of course you could really go directly to the wwwroot folder (or whatever folder name for your root) if you like so that you don't have to transfer the files.

Edper
  • 9,144
  • 1
  • 27
  • 46
0

Have a look at WAMP Server - it's easy to install and easy to use.

scrowler
  • 24,273
  • 9
  • 60
  • 92
0

You could install the XAMPP server in your machine.

The server will run in a directory you choose, and you will be able to run PHP files from your browser in the http://localhost address.

You find XAMPP here: http://www.apachefriends.org/en/xampp.html

Diego Malone
  • 1,044
  • 9
  • 25
  • I have no idea how to use XAMPP. I downloaded it but have no idea where to begin. How do I set it up and make changes on the server with the files on there using XAMPP? – TheAmazingKnight Nov 12 '13 at 04:59
  • It is easy to use. You can find more information [here](http://stackoverflow.com/questions/3652491/how-to-use-xampp-with-php) and [here](http://www.tutorialspoint.com/shorttutorials/run-a-php-program-in-xampp-server). You can also search for more tutorials. – Diego Malone Nov 12 '13 at 06:09
  • Thanks Diego! I'm a step closer to making it work. When I run Apache and put in http://localhost in the firefox browser, it just shows a blank page, nothing is being displayed like it should show XAMPP's website. I tried the same with Filezilla, same results, any idea why this occurred? – TheAmazingKnight Nov 12 '13 at 20:58
  • When you configure the XAMPP correctly, `http://localhost` should point to your htdocs XAMPP directory. In this directory you can find a index.html, that is the page that should be displayed. You can put other files in this directory (usually C:\xampp\htdocs) and point to them in the browser. Example `http://localhost/newpage.html`. – Diego Malone Nov 13 '13 at 21:22