Chapter 1 Introduction to PHP

Contributed By:: Shehrevar Davierwala

What is PHP ?

PHP is probably the most popular scripting language on the web. It is used to enhance web pages.

PHP is a program that gets installed on top of your web server software like Apache,Microsoft IIS and other server software packages.

PHP is a scripting language, like HTML. That means that code does not need to be compiled before it gets used — it gets processed on the fly as necessary.

Why PHP ?

PHP is used to enhance web pages

read more

Chapter 2 . PHP Environment Setup

Contributed By Shehrevar Davierwala

1. How to setup PHP environment?

In order to develop and run PHP Web pages three vital components need to be installed on your computer system.

 Web Server – PHP will work with virtually all Web Server software, including Microsoft’s Internet Information Server (IIS) but then most often used is freely availble Apache Server. Download Apache for free here:

 Database – PHP will work with virtually all database software, including Oracle and Sybase but most commonly used is freely available MySQL database. Download MySQL for free here:

 PHP Parser – In order to process PHP script instructions a parser must be installed to generate HTML output that can be sent to the Web Browser. This tutorial will guide you how to install PHP parser on your computer.

2. How to make sure environment is ready for php scripts?

it is important to make sure that you have proper environment setup on your machine to develop your web programs using PHP. Type the following address into your browser’s address box.

If this displays a page showing your PHP installation related information then it means you have PHP and Webserver installed properly. Otherwise you have to follow given procedure to install PHP on your computer.

3. How to install php on Windows with Apache?

    • Download Apache server from You want the current stable release version with the no_src.msi extension. Double-click the installer file to install; C:\Program Files is a common location. The installer will also ask you whether you want to run Apache as a service or from the command line or DOS prompt. We recommend you do not install as a service, as this may cause problems with startup.
    • Extract the PHP binary archive using your unzip utility; C:\PHP is a common location.
    • Copy some .dll files from your PHP directory to your system directory (usually C:\Windows). You need php5ts.dll for every case. You will also probably need to copy the file corresponding to your Web server module – C:\PHP\Sapi\php5apache.dll. to your Apache modules directory. It’s possible that you will also need others from the dlls subfolder.but start with the two mentioned previously and add more if you need them.
    • Copy either php.ini-dist or php.ini-recommended (preferably the latter) to your Windows directory, and rename it php.ini. Open this file in a text editor (for example, Notepad). Edit this file to get configuration directives; At this point, we highly recommend that new users set error reporting to E_ALL on their development machines.
    • Tell your Apache server where you want to serve files from and what extension(s) you want to identify PHP files (.php is the standard, but you can use .html, .phtml, or whatever you want). Go to your HTTP configuration files (C:\Program Files\Apache Group\Apache\conf or whatever your path is), and open httpd.conf with a text editor. Search for the word DocumentRoot (which should appear twice) and change both paths to the directory you want to serve files out of. (The default is C:\Program Files\Apache Group\Apache\htdocs.). Add at least one PHP extension directive as shown in the first line of the following code −
    LoadModule php5_module modules/php5apache.dll
    AddType application/x-httpd-php .php .phtml
        • You may also need to add the following line −
        AddModule mod_php5.c
        • Stop and restart the WWW service. Go to the Start menu → Settings → Control Panel → Services. Scroll down the list to IIS Admin Service. Select it and click Stop. After it stops, select World Wide Web Publishing Service and click Start. Stopping and restarting the service from within Internet Service Manager will not suffice. Since this is Windows, you may also wish to reboot.
        • Open a text editor. Type: <?php phpinfo(); ?>. Save this file in your Web server’s document root as info.php.
        • Start any Web browser and browse the must always use an HTTP request ( or http://localhost/info.php or rather than a filename (/home/httpd/info.php) for the file to be parsed correctly

        4. How to install php on Linux?

        To install PHP on Linux or any other variant of Unix, then here is the list of prerequisites −

        Now here are the steps to install Apache and PHP5 on your Linux or Unix machine. If your PHP or Apache versions are different then please take care accordingly.

        • If you haven’t already done so, unzip and untar your Apache source distribution. Unless you have a reason to do otherwise, /usr/local is the standard place.
        gunzip -c apache_1.3.x.tar.gz
        tar -xvf apache_1.3.x.tar
        • Build the apache Server as follows
        cd apache_1.3.x
        ./configure --prefix=/usr/local/apache --enable-so
        make install
        • Unzip and untar your PHP source distribution. Unless you have a reason to do otherwise, /usr/local is the standard place.
        gunzip -c php-5.x.tar.gz
        tar -xvf php-5.x.tar
        cd php-5.x
        • Configure and Build your PHP, assuming you are using MySQL database.
        ./configure --with-apxs=/usr/sbin/apxs \
        make install
        • Install the php.ini file. Edit this file to get configuration directives −
        cd ../../php-5.x
        cp php.ini-dist /usr/local/lib/php.ini
        • Tell your Apache server where you want to serve files from, and what extension(s) you want to identify PHP files A .php is the standard, but you can use .html, .phtml, or whatever you want.
            • Go to your HTTP configuration files (/usr/local/apache/conf or whatever your path is)
            • Open httpd.conf with a text editor.
            • Search for the word DocumentRoot (which should appear twice), and change both paths to the directory you want to serve files out of (in our case, /home/httpd). We recommend a home directory rather than the default /usr/local/apache/htdocs because it is more secure, but it doesn.t have to be in a home directory. You will keep all your PHP files in this directory.
            Add at least one PHP extension directive, as shown in the first line of code that follows. In the second line, also added a second handler to have all HTML files parsed as PHP.

            <pre class="result

            read more

Chapter 3:: PHP Solved Questions

Contributed by:Mahgul Afzali

Let,s begin from the scratch where we can lead you on the practice of these languages.This is a very useful matreail on php which you can go through it and learn the php . Perhaps you can go to any of the websites where you have to spend a hefty amount of time . But here at we provide functional and easy to understand PHP tutorial for beginners with solved examples.

<span style="font-family

read more

Chapter 1. What Is C?

Contributed By : Shehrevar Davierwala

  1. What Is C?

C is a programming language that allows a software engineer to efficiently communicate with a computer. C is a highly flexible and adaptable language. Since its creation in 1970, it’s been used for a wide variety of programs including firmware for micro -controllers, operating systems, applications, and graphics programming. C is one of the most most widely used languages in the

read more

Chapter 2 How to install C? Environment Setup

Contributed By: Shehrevar Davierwala

You really do not need to set up your own environment to start learning C programming language. Try following example using our online compiler option available at

Local Environment Setup:

If you want to set up your environment for C programming language, you need the following two software tools available on your computer, (a) Text Editor and (b) The C Compiler.

What is a text editor?

This will be used to type your program

read more

Chapter 3 My first C Program

Contributed By: Shehrevar Davierwala

A C program, whatever its size, consists of functions and variables. A function contains
statements that specify the computing operations to be done, and variables store values
used during the computation.

Below is the simple program in C

1 /* First C program: Hello World */
2 #include <stdio.h>
4 int main(void)
5 {
6 printf(“Hello World!\n”);
7 }

(Please avoid

read more

Chapter 4. How to compile & execute C program?

Contributed by : Shehrevar Davierwala

( Note below lines of code are with respect to gnu )

The Compiler
A C program is made by running a compiler which takes the typed source
program and converts it into an object file that the computer can execute. A
compiler usually operates in two or more phases.

  •  Phase 1 scans a source program, perhaps generating an intermediate
    code (quadruples or pcode) which helps to simplify the grammar of the
    language for subsequent processing. It then converts the intermediate
    code into a file of object code (though this is usually not executable
    yet). A separate object file is built for each separate source file. In the
    GNU C compiler, these two stages are run with the command gcc -c;
    the output is one or more .o files.
  • Phase 2 is a Linker. This program appends standard library code to
    the object file so that the code is complete and can “stand alone”. A C
    compiler linker suffers the slightly arduous task of linking together all
    the functions in the C program. Even at this stage, the compiler can
    fail, if it finds that it has a reference to a function which does not exist.
    With the GNU C compiler this stage is activated by the command gcc
    -o or ld.

On GNU systems, this results in the creation of an executable program with the default name a.out. To tell the compiler what you would like the executable program to be called, use the -o

read more