Page 172 - TrackpadV5.1_class7
P. 172

TECHIPEDIA (PHP)







                  Today, we use various websites which 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 due to the use of scripting languages. There are various scripting languages like
                  JavaScript, Active Server Pages (ASP), ASP.NET, and PHP. Let us learn about PHP in detail.

                  PHP

                  PHP (Hypertext Preprocessor) is a server side scripting language. It is very popular and powerful

                  language to develop dynamic web pages. It is freely available to use. It is embedded in HTML
                  pages. The programs written in PHP are interpreted by a web server. 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 which allow to interpret the PHP programs and execute them. Some of
                  the web servers are as 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 the 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.






                  170   Pro (V5.1)-VII
   167   168   169   170   171   172   173   174   175   176   177