Home » PHP

PHP installation and setup

6 November 2009 by Keshav Shetty 7,906 views 2 Comments

In order to start development with php you need three components

  1. Database (I prefer Mysql)
  2. Web server (I prefer Apache)
  3. PHP interpreter

I assume you are using MS Windows for your development.

First download and install MySql from MySql 5.0 downloads

Next download and install Apache from Apache 2.2 downloads

Next download and unzip php to say c: from PHP 5.2 download

Some additional steps

  1. Copy php.ini-recommended as php.ini in your PHP installation directory
  2. In new php.ini file update the properties extension_dir = “c:\php\ext\” (I assume that you extracted php to c:\php folder – if it is different update your correct path)
  3. In new php.ini file enable extension=php_pdo.dll extension=php_sqlite.dll extension=php_mysql.dll extension=php_pdo_mysql.dll
  4. Edit httpd.conf file under conf folder of Apache installation, add the following lines at the end of the file

AddType application/x-httpd-php .php
LoadModule php5_module “c:\php\php5apache2_2.dll”
SetEnv PHPRC C:\php\

Thats it your dev environment is ready. Start the Apache server.

Write a simple file called as test.php with the following content

<?php echo ‘Welcome to php’; ?>

and save it as test.php under the folder htdocs of your apache installation folder.

From you web browser access the file as http://localhost/test.php

You should see the result as Welcome to php

Continue with next lesson Variables & operators

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

2 Comments »

  • Saorabh Kumar said:

    hi

    I am getting the error of http.conf as one of the module, i.e.
    LoadModule php5_module “c:\php\php5apache2_2.dll”

    seems not loading….
    and its throwing syntex error for the line:

    Invalid LoadModule path \x93c:\\php\\php5apache2_2.dll\x94

  • Saorabh Kumar said:

    Its working now:
    the second line need to edit, and it should be like

    LoadModule php5_module c:\php\php5apache2_2.dll, instead of..

    AddType application/x-httpd-php .php
    LoadModule php5_module “c:\php\php5apache2_2.dll”
    SetEnv PHPRC C:\php\

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.