Sunday, July 22, 2012

Create your first PHP-enabled page

Hello,

Today I will explain how you can create your first php enabled page. A PHP script starts with
  <?php and ends with ?>

 First of all open any text editor(notepad++)

create a file name index.php and put it in your web server's root OR /www OR puclic_html directory with the following content.

<html>
<head>
<title>Homepage</title>
</head>

 <?php
 echo 'Hello World';
 ?> 

</body>
</html>

Use your default browser to see output of this code with your web server's url ending with the /index.php
If you are using localhost then try http://localhost/index.php or http://127.0.0.1/index.php

If everything is fine you will see result like


Hello World



Thank you.

Sunday, July 15, 2012

Things you should know about PHP

Before you start to work with PHP you should have some basic understanding about how it works, what are the requirements and what it can do? Why you should use PHP? etc.

PHP is widely used programming language to create dynamic websites
PHP scripts executed on the server side. As PHP is open source you can freely download and use. PHP files can contain text, HTML, Advance Java code. Once PHP is executed you can see result as plain HTML  in the browser. All PHP files have a default extension of .php
PHP can run of platforms like Windows, Linux, Unix, Mac. It is also compatible with almost all servers that are available today.

To develop websites using PHP you can

  • Find a web host with PHP and MySQL support (e.g 000webhost.com)
  • Install a web server on your own PC, and then install PHP and MySQL 
i.e THe Uniform server, xxamp, wamp, etc.

Official resource page for php is www.php.net

Thursday, July 12, 2012

Introduction to PHP


PHP is a server side language , and is a powerful tool for making dynamic Websites.
PHP stands for  Hypertext Preprocessor

It is a widely-used because it is free (open source) and efficient alternative to competitors such as Microsoft's ASP. Also PHP can be embedded into HTML.

Here is simple example to print welcome to world of php.

<!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 "Welcome to world of php.";
        
?>
    </body>
</html>