Feeds:
Posts
Comments

Archive for the ‘PHP’ Category

Greetings!

Our project (trainersunoin.com) is going to be a web application, it is necessary to know the bits and pieces of the web language, PHP.

Since i dont know anything about it, i started to learn it from the scratch.

So, here is my first day learning experience

What is PHP ?

  • PHP stands for Hypertext Preprocessor

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

Source : http://www.php.net/manual/en/intro-whatis.php

 

  • Server side scripting language
  • Code is executed on the server, resulted HTML is sent to the client
  • Scripts are used to generate dynamic and interactive web pages

History of PHP:

  • Initially called as PHP/FI (Personal Home Page /Forms Interpreter ) in 1995
  • Created by Rasmus Lerdorf
  • Later Andi Gutmans, Zeev Suraski and Rasmus Lerdorf worked together and released PHP 3.0 with the name Hypertext Preprocessor

Installation:

  • Essential to install LAMP Stack
  • From the terminal type the command (on ubuntu 10.04 )

sudo tasksel install lamp-server

  • The above command will install Apache,MySql,PHP ( while installing you will asked to enter mysql root password)

Before running PHP Scripts:

  • Files should  end with .php extension
  • All PHP scripts must be saved/put inside web server’s root directory (DOCUMENT_ROOT(/var/www/))
  • Scripts starts with <?php and ends with ?> tag

Creating first .php script:

  • As a root user, open a text editor with file name hello.php

root@rajee-laptop:/var/www# gedit hello.php

  • Include the following script in hello.php file

<?php
echo “Hello PHP”;
?>

  • As a root user, start apache server (on ubuntu 10.04)

root@rajee-laptop:/home/rajee# /etc/init.d/apache2 start
* Starting web server apache2                                                  apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

  • Open a web browser and type http://localhost/
  • Now you can see a message printed as “It works………” (It means Apache server is started)
  • To run the php script, type http://localhost/hello.php
  • Your output is printed as “Hell PHP”

To get more information in PHP include the script in a file (more.php)

<?php
phpinfo();
?>

Open the browser and  run it as http://localhost/more.php

Now you can see a table like structure as below  which displays more information regarding PHP

Going to delve PHP more and more…. :):)

 

 

Read Full Post »