Monday, 29 June 2015

Introduction to PHP


PHP-Hypertext preprocessor
It is an open source scripting language
PHP scripts are executed on the server

PHP Files:
PHP files can contain text, HTML, CSS, JavaScript, and PHP code
PHP code are executed on the server, and the result is returned to the browser as plain HTML

PHP files have extension ".php"

Purpose of PHP:
•PHP can generate dynamic page content
PHP can create, open, read, write, delete, and close files on the server
PHP can collect form data
PHP can send and receive cookies
PHP can add, delete, modify data in your database
PHP can be used to control user-access
PHP can encrypt data
With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.
PHP server on your pc:
However, if your server does not support PHP, you must:
  • install a web server(Apache,IIS etc)
  • install PHP
  • install a database, such as MySQL
The official PHP website (PHP.net) has installation instructions for Authenticated PHP link: http://php.net/manual/en/install.php

Sample PHP program:
PHP program starts with the following syntax:
<?php
//code
?>

//program 

<html>
<body>
<h1>My PHP</h1>
<?php
echo "Hai friends"
?>

</body>
</html>


NOTE:
Save the program with extension .php
The output is obtained only when we start the webserver and click the file name found on it.


No comments:

Post a Comment