Skip to content

PHP

What is PHP

PHP stands for Hypertext PreProcessor. PHP is a general purpose scripting language, especially suited for web development and can be embedded into HTML.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hello World";
?>
</body>
</html>

What can PHP do

PHP is mainly focused on server-side scripting, there are three main areas where PHP scripts are used,

  • Server-side scripting.
  • Command line scripting.
  • Writing desktop application.

PHP can be used on all major operating systems, including Linux, many Unix variants, Windows, Mac OS X and probably others. PHP also supports most of the web servers today such as Apache, IIS, Personal web server, Netscape and iPlanet servers, caudium and many others. One of the strongest and most significant feature of PHP is it supports wide range of databases like MySQL, InterBase, FrontBase, ODBC, Oracle, PostgreSQL, SQLite, Sybase and many more

PHP Version History

PHP/FI

PHP/FI was created by Rasmus Lerdorf in 1995, initially as a simple set of Perl Scripts for tracking his online resume. He named the set of scripts as “Personal Home Page Tools”. As more functionality required, Rasmus wrote much larger C implementation, which was able to communicate with database and enabled user to develop simple dynamic web applications.

PHP 3

PHP 3 was the first version that closely resembles PHP as we know today. It was created by Andi Gutmans and Zeev Suraski in 1997.

PHP 4

The design goals were to improve complex application and improve the modularity of PHP’s code base. In this version the new engine ‘Zend engine’ was introduced.

PHP 5

This was released in 2004, with the Zend engine 2.0 and new object models.

PHP and Other Languages

PHP vs. ASP

ASP (Active Server Pages) is a server side scripting language, which is used to generate dynamic web pages along with HTML. The actual language used to program ASP includes Visual basic script (VB Scripts), J Script and C# among others. The biggest drawback of ASP is natively used only on the Microsoft Internet Information Server (IIS) platform. This is available only to Win32 based servers. ASP is said to be slower than PHP with less overall stability.

PHP vs. Perl

Perl (Practical Extraction and Reporting Language) is a very powerful, robust language. PHP was designed for scripting for the web, while Perl was designed to do a lot more. Because of this, Perl can get very complicated. PHP has less-confusing and stricter format without losing flexibility. PHP is also easier to integrate into existing HTML than Perl. PHP’s Command-line interpreter (CLI) is powerful enough to perform high-level tasks.

How To Run PHP

The main targeting field for PHP is server-side scripting language. You need three things to make this work, the PHP parser (CGI or Server modules), web server and a web browser. You need to run the web server, with a connected PHP installation. You can access the PHP program output with the web browser. Instead, we have some web server packages like Zend Server, XAMPP, WAMP, MAMP, SAMP where the web server and parser are build and configured. Here I am going to use XAMPP.

XAMPP

XAMPP is a free and open source cross-platform web server package, consisting mainly of the Apache HTTP Server, MySQL database, and interpreters for scripts written in the PHP and Perl programming languages.

XAMPP stands for:

  • X (meaning cross-platform)
  • Apache HTTP server.
  • MySql.
  • PHP.
  • Perl.

Download XAMPP

Installing XAMPP in Windows

  1. Run the installer. If you want, you can choose to install the Apache and MySQL servers as services, which will make them start automatically every time you start Windows. If you don’t choose this option, you will need to use the XAMPP Control Panel application to start the servers individually each time you need them. This may be desirable if you don’t intend to use your servers that often.
  2. Upon completion of installation, the XAMPP Control Panel will open (if not, click Start » All Programs » Apache Friends » XAMPP » XAMPP Control Panel). This tool lets you start and stop the various servers installed as part of XAMPP.
  3. Start Apache and MySQL by clicking on the “Start” buttons next to each item. If prompted by Windows Firewall, click the button labelled “Unblock”.
  4. Go to http://localhost. If you are directed to a page with the XAMPP logo, your installation was successful.
  5. http://localhost/phpmyadmin. Here you find the Database Management.
XAMPP Control Panel

XAMPP Control Panel

After Installation You can add or change the files in C:xampphtdocs to change what you see at http://localhost/ on any local web browser.

PHP Syntax

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: