What is PHP?

PHP is a worldwide used open source and free server scripting language. PHP stands for Hypertext Preprocessor. It is widely used for web development of both dynamic and interactive web pages. The best part is PHP can be embedded into HTML. If you are unfamiliar, then Facebook, Google and Yahoo are all created with the help of PHP.

What is the course all about?

This course will give you an insight into how to learn PHP from scratch.

Audience:

The target audience for PHP tutorial for beginners is computer programmers with limited knowledge of PHP and related languages.

Well, if you now talk about PHP. Then, PHP language has been improved with a number of improvements. The latest in the PHP house is PHP 7. So, we will majorly focus on PHP 7 tutorial.

Step By Step PHP 7 Tutorial:

Step 1: Getting Started with PHP:

The first step is to setup a local server. For executing a PHP script on the web server, you will require a running PHP webserver. So before writing any PHP code, you will need the following installed in your PC.

The Apache Web server The PHP engine The MySQL database server

You can install them individually or purchase a preconfigured package for your OS. Well, the popular and easily available ones are XAMPP or Wampserver. Start by installing XAMPP or WampServer on your system. This will help you build web applications based on a PHP code. Some basic skills and knowledge of CSS and HTML are going to be great to learn PHP.

Step 2: Learning PHP Syntax

A PHP Syntax is quite simple. The PHP script starts and ends with tag. With PHP in between. Look at the example:

The use of this syntax clearly tells the PHP engine that the enclosed code is a PHP code instead of a simple HTML code. A PHP statement is closed with a semicolon, which clearly states that the current statement has ended.

Step 3: Creating Your First PHP Script

Once you have successfully installed the XAMPP or Wampserver on your system. Let’s learn how to create a simple PHP script displaying “Welcome to PHP Tutorial” in the browser. We will be using the WampServer to complete this task.

Click the WampServer icon from your windows taskbar.

Choose the “www directory.” You can also choose the “www” directory by navigating through the C:\wamp\www. Create a subdirectory within the main directory by the name “Test Project.” Open up your favorite code editor, e.g. Netbeans, Eclipse, PHPStorm, etc. Create a new PHP file. Type the following code: // Display greeting message echo “Welcome to PHP Tutorial”; ?> Save the file by testfile.php in your project folder. Check the output in the browser by visiting URL: http://localhost/project/testfile.php.

Step 4: Understanding PHP Error Messages

If you have skipped anything in the entire syntax. Then, you are bound to get an error. An error that looks something like this: Parse error: parse error in C: Inetpubwwwrootwebtestfile.php