Feb 18, 2011 - Article, Technology, Training    No Comments

PHP for beginners



PHP

  • PHP stands for “PHP Hypertext Preprocessor”
  • an HTML-embedded server-side scripting language
  • used to make web pages dynamic
    • process form information
    • authenticate users
    • provide different content depending on context
    • interface with other services: database, e-mail, etc
  • generates HTML and/or client-side scripts sent to client browsers
  • similar syntax to Javascript

Why PHP ?

free and opensource , anyone can run the server , simple syntax (almost similar to C ), lot of built-in functionality

nut and bolts

Extension for php file is .php . We can include html , JavaScript in a php file . PHP codes are hidden for client side users.

Things we need

  1. A Server with php version greater than 4.
  2. MySql database if needed.

Most of the linux version come with apache server , php and mysql

you can start the httpd server by using this command

root@randomlogics:~$ service httpd start

to start mysql database server in linux use this command

root@randomlogics:~$ service mysqld start

to restart type restart instead of start

to stop both servers type stop instead of start

Try to use lamp instead of built-in httpd apache server.

http://www.apachefriends.org/en/xampp-linux.html

For windows

http://www.apachefriends.org/en/xampp-windows.html

install the exe

click the xampp-contoller.exe located at c:\xampp\

then click strat button of  apache and mysql

open any browser then type http://localhost

then select language

Done!…  xampp installed in our system

Creating a project

For  create a project in server

  1. Press windows key + r    or  click start -> run
  2. type C:\xampp\htdocs
  3. create a folder (Folder name must be you project name)

To execute php files , you need to put the php file inside htdocs\foldername\

if you are using wamp as server , then make the folder inside www and put the php files inside it.

To run the project

  • select your Favorite browser
  • then type http://localhost/projectfoldername

Index file

—————–

index named file will load first defaulter in a server , so home page must be index named file

index.php have more priority than index.html

———————————————————————————————————————————————

So let’s start PHP

For this tutorial purpose i am using project name as test

so C:\xampp\htdocs\test\

open notepad

then  type <?php  echo phpinfo();  ?>

then save filename as index.php

run the project in any browser

http://localhost/test

Article will be publish soon ………………………..



PHP for beginners – Part 2


Got anything to say? Go ahead and leave a comment!

*

Powered By Indic IME

Switch to our mobile site