PHP fhp - what you'll need

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

1) PHP authoring environment

  • any text editor will do, but I recommend one with syntax coloring especially for someone new to coding or PHP. Notepad++ is my favorite so far with its ease of use, customizability and the ability to collapse(fig 1) tags. All editor help will be in reference to Notepad++
  • installing and configuring Notepad++
      • 1) download and execute the binary file Notepad++
      • 2) open Notepad++
      • 3) in the "language" tab choose "PHP" <-- colors the syntax for easy recognition
      • 4) in the "view" tab choose "WRAP" <-returns long lines to the next line without adding line breaks.


2) PHP running environment

  • now that you have the ability to create and save PHP files you need an environment that can process them and generate the output that your browser displays. There are two ways to accomplish this.
      • 1) get a web host that supports PHP and upload your files every time you make a change.
      • 2) use you own computer as a personal server with PHP support, and only upload final versions to a web host.
  • accomplishing #2 is actually easier than you think. (assuming you are running Windows)
      • 1) download and install The uniform server
      • 2) in the directory where you had it extract hit the "start.bat" (fig 2) file to get the server running
      • 3) place any files you want the server to read and process in the "...diskw/www/" folder (fig 2). and of course you can have sub-folders.
      • 4) point your browser to a file located in your "www" folder to see its server processed result.
      • note: "Localdisk W" in "My Computer" is the same as the "diskw" folder.
      • try it out
        • save this link in your "www" folder and then point your browser to it. it should say "your computer can now run PHP"


figure 2: location of start.bat and "www" folder

PHP Uniserver folders.png

  • now you have the resources to effectively edit PHP documents and process them on your own computer.