Using Notepad or TextEdit for PHP

How to Create and Save PHP in Windows and macOS

Student using laptop in library
Saving PHP Files in Notepad. Manley099/E+/Getty Images

You don't need any fancy programs to work with the PHP programming language. PHP code is written in plain text. All Windows computers including those running Windows 10 come with a program called Notepad that is used to create plain text documents. It's easy to access via the Start Menu. 

Using Notepad to Write PHP Code

Here is how you use Notepad to create a PHP file:

  1. Open Notepad. You can find Notepad in Windows 10 by clicking the Start button on the taskbar and then choosing Notepad. In earlier versions of Windows you can find Notepad by choosing Start > All Programs > Accessories > Notepad.
  1. Enter your PHP program into Notepad.
  2. Choose Save As from the File menu.
  3. Enter the file name as your_file.php being sure to include the .php extension.
  4. Set the Save As Type to All Files.
  5. Finally, click the Save button.

Writing PHP Code on a Mac

On a Mac? You can create and save PHP files using TextEdit—Mac's version of Notepad. 

  1. Launch TextEdit by clicking its icon on the dock.
  2. From the Format menu at the top of the screen, choose Make Plain Text, if it isn't already set for plain text.
  3. Click New Document. Click the Open and Save tab and confirm the box next to Display HTML files as HTML code instead of formatted text is checked.
  4. Type the PHP code into the file.
  5. Choose Save and save the file with a .php extension.