Wednesday, April 29, 2009

Setting up multiple virtual hosts on wamp in XP

This was something which needed desparately. Finally, I learnt how to setup multiple virtual hosts on WAMP. Here you go.

When you install WAMP, it gets installed as a package and the webroot pointing to
      C:\wamp\www.

1. Create a project directory, for example 
      C:/wamp/www/MyProject

2. Add the new host name in Windows hosts file located at
     C:\WINDOWS\System32\drivers\etc\hosts

     127.0.01 localhost
127.0.0.1 myproject

3. Edit the httpd.conf file to add path to virtualhosts definitions. In WAMP, by default this is line is commented. We have to uncomment the line and link it to correct file path.
       # Virtual hosts
         Include conf/extra/httpd-vhosts.conf

4. In httpd-vhosts, specify the mapping from MyProject folder to the new hostname.
       NameVirtualHost *:80

# this is the default mapping to http://localhost/ 
     <VirtualHost *:80>
         DocumentRoot C:\wamp\www 
         ServerName localhost 
     <\VirtualHost>

# this is the default mapping to http://myproject/ 
  &lt;VirtualHost *:80>
       DocumentRoot C:\wamp\www\MyProject\html 
      ServerName myproject
      <Directory "C:\wamp\www\MyProject>
           Options Indexes FollowSymLinks Includes 
          AllowOverride All 
          Order deny,allow 
           Deny from all
           Allow from 127.0.0.1 
             DirectoryIndex index.php 
         <\Directory>
<\VirtualHost>


5. Restart apache.

Good to go.

Hav fun :)

Wednesday, April 8, 2009

PHP - Introduction

In my few years of web programming, I have spent most of the time programming in PHP. Programming has gone through a drastic change from being procedural to Object Oriented. PHP as one of the web language, was/is never a stranger to these changes. 

PHP was conceived by Rasmus Lerdorf in 1994, written in C language. Intially, PHP stood for Personal Home Page, which was later changed by two Isreli developers Zeev Suraski and Andi Gutmans in 1997. They rewrote the scripting language and formed the base of PHP3, changing the name PHP to Hypertext Preprocessor. PHP was used for embedding a set of executable scripts in the web page. In late 1998, Zeev and Andi felt that they could have written the language in a much better way and came up with PHP4, which followed a new paradigm "compile first and execute later". The compliation step does not compile PHP script into machine code, instead compiles into byte code which is executed by Zend Engine. It became a full fledged system, offering flexibilty as any other web based programming language. An Object Model was also introduced with few quirks and limitations. 

The release of PHP5 came up with the revised Object Oriented part of Zend Engine, which made  PHP5, a matured programming language. Not only does it revolutionize PHP's Object Oriented support, but also the new extensions like SimpleXML, MYSQLi, SOAP, etc., made it the ultimate web development platform.

Let us discuss more in detail about advanced object oriented features of PHP5 in the forthcoming  posts.

Happy PHP'ing !!!