Thursday, November 17, 2011

Running PHP5 in XAMPP - Solved

Similar Problem - I have installed XAMPP on a Windows machine but cannot seem to get my PHP5 extensions working. If I go to a page http://localhost/contact.php everything displays fine but if I change the filename to contact.php5 and then try to browse to http://localhost/contact.php5 all I see is my code. My host requires me to specify the .php5 file extension. I've installed XAMPP Apache server and put my website into htdocs. I've started Apache server. On my website I've got files with extension PHP and with extension PHP5.The difference is that when I type in into browser localhost/file.php - I see a parsed website. But when I type localhost/file.php5 (i have this file on server), than browser asks me if I want to download or open this file. And if I choose open than I see PHP code of file.php5!

If you also have trouble in running php5 files in Xampp. Then this will help you. 

Steps
  1. Open C:\xampp\apache\conf\extra\httpd-xampp.conf file in text editor
  2. Below LoadModule php5_module modules/php5apache2_2.dll
    You can see,

    SetHandler application/x-httpd-php


    SetHandler application/x-httpd-php-source
  3. Replace the above set with the below one,

    SetHandler application/x-httpd-php


    SetHandler application/x-httpd-php-source
     
  4. Find this set of code,

    AddType text/html .php .phps
  5. Replace the above set with this one,

    AddType text/html .php .phps .php5
  6. Done !!!
     
    Share, if it works.

2 comments:

yga said...

Ya ma dear friend,It works fine.I'm also searching for the solution of this problem ,Now it's working well.Really helpful ur blog,Hatz of u again.....

Aravind NC said...

Great to see its working. Keep Going !

Popular Posts