1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Your First PHP Script

A walk through of creating your very first PHP script


  1. The first thing you need is somewhere to write your PHP code. One solution is using Notepad (or Textedit on a Mac), which probably comes standard on your computer. If you already have HTML software, it will probably work for PHP as well.

  2. Next you need some code to write! You probably want to start with these basic functions.

  3. Now you need somewhere to run your new code. If you've tried saving it and opening it in your browser, you might be disappointed to simply see your code. That is because you need a platform running PHP. If you have website hosting, there is a very good chance they support PHP. If you want to run the files directly on your computer, and not on the web, you will need to install PHP on Windows, or activate PHP on a Mac.

  4. If you choose to run PHP on your own computer you can ignore this step... if you choose to use your hosting, you need to upload your PHP file. You can upload your file using an FTP program, along with the username and login from your host.

  5. Finally, you use your browser to navigate to the file (either on your computer, or on your website) and see the final results. Congratulations, you've written your first PHP script!
Related Video
Basic PHP Syntax
Using PHP With HTML
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Learn PHP
  5. First PHP Script - Very Basic PHP

©2014 About.com. All rights reserved.