PDF download Download Article
Two simple ways to run a PHP file on your computer
PDF download Download Article

This wikiHow teaches you how to open and edit a PHP programming file on your Windows or Mac computer.

Opening a PHP File

  1. Download Notepad++ (Windows) or BBEdit (Mac).
  2. Open the downloaded application on your computer.
  3. Click File at the top of your screen.
  4. Select Open from the drop-down menu.
  5. Click on your PHP file and click Open .
Method 1
Method 1 of 2:

Using Windows

PDF download Download Article
  1. Notepad++ is a free, Windows-only text editor that can open PHP files. To install it, do the following:
    • Go to notepad-plus-plus.org/download/v7.5.8.html in your computer's web browser.
    • Click the green DOWNLOAD button.
    • Double-click the Notepad++ setup file.
    • Follow the installation prompts.
  2. If Notepad++ doesn't automatically open after you finish installing it, open Start
    Windows Start
    , type in notepad++ , and click Notepad++ at the top of the results.
    Advertisement
  3. It's in the top-left corner of the Notepad++ window. A drop-down menu will appear.
  4. This option is in the drop-down menu. Doing so brings up a File Explorer window.
  5. Go to the location of your PHP file, then click the PHP file to select it.
  6. It's in the bottom-right corner of the window. This will open the PHP file in Notepad++, allowing you to view the file's code and make any necessary edits.
    • If you do edit your PHP file, press Ctrl + S to save the changes before you exit Notepad++.
  7. Advertisement
Method 2
Method 2 of 2:

Using a Mac

PDF download Download Article
  1. This free program allows you to view and edit numerous different file types, PHP included. To install it, do the following:
  2. Click the magnifying glass-shaped icon in the top-right corner of the screen to do so.
  3. Type in bbedit , then double-click BBEdit in the resulting drop-down menu.
    • If this is your first time opening BBEdit after installing, click Open when prompted, then click Continue to continue with the 30 day trial.
  4. It's in the top-left corner of the screen. A drop-down menu will appear.
  5. This is in the File drop-down menu. Doing so opens a Finder window.
  6. Go to the location in which your PHP file is stored, then click the PHP file to select it.
  7. It's in the bottom-right corner of the window. Doing so opens the PHP file in BBEdit; you should now be able to see the PHP file's text.
    • You may instead click Choose here.
    • If you edit your PHP file, be sure to save it by pressing ⌘ Command + S .
  8. Advertisement

Community Q&A

Search
Add New Question
  • Question
    PHP file is running in xampp only when it is stored or copied in htdocs. I want to know why we aren't able to run the php files in their current locations instead of changing their directories?
    Community Answer
    When you are running XAMPP, it is creating a web server which runs the file. The web server expects the files to be stored in the public directory, which is configurable, and defaults in the case of XAMPP to htdocs.
  • Question
    Can I print a PHP file?
    Community Answer
    Yes, you could just click File > Print. Or you could copy it into another text editor and print it from there.
  • Question
    Which is the best to use on a .PHP in my documents?
    Community Answer
    At the very least, you want a plain text editor, as PHP will be plain text. However, PHP is a programming language, so you are better off using a proper PHP editor which will make it look easier to read and edit. There are many available, depending on your operating system and budget, but if you just want to see what the file is, notepad will do.
See more answers
Ask a Question
      Advertisement

      Tips

      • Dragging and dropping your PHP file into most web browsers (excluding Firefox) will open the PHP file's code. While the PHP file probably won't display correctly, you'll at least be able to view the file's code itself.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      • Always save a copy of your original PHP file before making any changes. Editing the code incorrectly can cause your website to stop functioning, so it's always best to have a backup.



      Advertisement

      About This Article

      Article Summary X

      To open a PHP file on Windows, search online for Notepad++, which is a free text-editor, and download it to your computer. Once it’s finished downloading, double-click the setup file and follow the prompts to install it. After it’s installed, open Notepad++. Then, click "File" and "Open" and locate your PHP file from the file explorer. To open a PHP file on a Mac, search online for BBEdit and download it. Double-click the downloaded DMG file and drag the BBEdit icon to your “Applications” folder. When it’s finished copying, open the program from your applications. Then, click “File” and “Open” and select your PHP file from the finder window. For more tips, including how to print a PHP file, read on!

      Did this summary help you?
      Thanks to all authors for creating a page that has been read 922,908 times.

      Reader Success Stories

      • Anonymous

        Feb 28, 2017

        "Variety of options to suit user level, requirement and choice."
      Share your story

      Is this article up to date?

      Advertisement