Characteristics of PHP
The five
important characteristics of PHP are:
- Simplicity
- Efficiency
- Security
- Flexibility
- Familiarity
Using PHP
PHP files can
contain text, HTML, JavaScript, and PHP code
PHP code is
executed on a server and is returned to the browser as plain HTML
PHP files use a
default extension (.php)
PHP code must be
included in one of the following tags:
<?php PHP CODE
GOES HERE ?>
<? PHP CODE
GOES HERE ?>
<script
language = "php"> PHP CODE GOES HERE </script>
Example
Script: First.php
<!DOCTYPE
html>
<html>
<body> <?php echo "My first PHP
script!";?>
</body>
</html>
OUTPUT:
My first PHP
script!
Components
Required for PHP
WebServer
- PHP works with almost all WebServers including Wampserver, Microsoft's Internet Information Server (IIS). The most commonly used WebServer is Apache Server.
- Data base
- PHP works with a almost all databases including Oracle and Sybase. The most commonly used database is MySQL which is available for free.
- You can download MySQL at: http://www.mysql.com/downloads/index.html
- PHP Parser
- PHP requires a parser that processes PHP scripts and generates HTML output that is sent to Web browser.
Setting up
WebServer
- In this course, you will use Wampserver as the WebServer.
- Download wampserver2.2 from http://www.wampserver.com/en/ download-wrapper
- Install wampserver
Using Wampserver
- After you have installed wampserver, it can be used to run PHP script.
- Wampserver creates an icon in the in the taskbar which can be used perform tasks such as starting or stopping the server, viewing configuration pages, viewing help files.