Page 110 - Trackpad_V4.0_c7_Flpbook
P. 110
PHP
Today, we use various websites that accept data like name, address, etc. from us and return the result
accordingly. Do you know how these websites accept data and return the result dynamically? This is
possible because of scripting languages. There are various scripting languages like JavaScript, Active
Server Pages (JSP), ASP.NET, and PHP. Let us learn about PHP in detail.
PHP
PHP (Hypertext Preprocessor) is a server side scripting language. It is a very popular and powerful
language to develop dynamic web pages. It is freely available to use. It is embedded in HTML pages. A
web server interprets programs written in PHP. So, we need to install a webserver before executing a
PHP program.
Installing a Web Server
A web server is a program that executes a script and shows the output in a web browser. There are
various web servers that allow to interpret the PHP programs and execute them. Some of the web
servers are Apache HTTP Server, WampServer, NGINX, etc. You can install any of the web servers to
execute a PHP script.
XAMPP is one of the most commonly used application packages that is a combination of a web server
and required libraries to run a PHP script. It is a cross-platform environment where you can execute
your PHP scripts. You can download XAMPP application from the following link:
https://www.apachefriends.org/download.html
After installing XAMPP, start the the Apache HTTP Server. Now you can execute your PHP scripts.
CREATING AND RUNNING A PHP SCRIPT
Before writing the first PHP script, you need to know how to add a PHP script into an HTML document.
A PHP script is added to an HTML document with the help of PHP start tag <?php and end tag ?>. The
syntax is as follows:
<?php
//PHP code
?>
After adding the PHP script, save the file with .php extension.
Premium Edition-VII
108

