The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Switching the version of PHP

Discussion in 'General Discussion' started by thewebhosting, Dec 1, 2008.

  1. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Hello Guys,

    I have compiled apache to use both the versions of PHP 4 and PHP 5. I have set default version of PHP to 4.4.9 from WHM. Now, to use PHP version 5 for a domain I have added below code in my .htaccess file.


    AddHandler x-httpd-php5 .php

    However, when I browse a .php file for the domain using php version 5 it shows me a prompt of download my .php page??

    How can I fix this?

    I want to do following:

    1. Default version of PHP on my server is 4.0
    2. I want users to switch over PHP 4 to PHP 5 by adding a code in their .htacess file.

    Thanks,
     
  2. apscinsspl

    apscinsspl Well-Known Member

    Joined:
    Mar 15, 2008
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    16
    This code worked for me


    AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
     
  3. stdout

    stdout Well-Known Member

    Joined:
    Apr 10, 2003
    Messages:
    189
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Nelspruit, Mpumalanga, South Africa
    cPanel Access Level:
    Root Administrator
    Check out /usr/local/apache/conf/php.conf for the default MimeTypes/Handlers.
     
  4. whplus

    whplus Well-Known Member

    Joined:
    Dec 8, 2007
    Messages:
    66
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Behind your business
    you can use "php configuration" menu to select default php version for cpanel user.

    susan,
     
  5. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Thanks..it works like charm!!!

    But, can you tell me in which file it makes the changes for a particular domain to use a different version of PHP?
     
  6. chuza

    chuza Well-Known Member

    Joined:
    Jul 4, 2008
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    cPanel creates the php AddHandler in .htaccess file of the account to change the version.
     
  7. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    I have checked in my .htaccess file and it is blank. Any other suggestions?
     
  8. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    Check the .htaccess in /home/username/ folder because this is where the handler is added not the /home/username/public_html/.htaccess file.
     
  9. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Thanks for the information!!

    I have found the code at the path you have provided. Actually, I was looking at the .htaccess located at home/user/public_html.

    Thanks again!
     
  10. prettydumb

    prettydumb Active Member

    Joined:
    Aug 25, 2007
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    I navigated to the home/username folder via WinSCP and there was not an .htaccess file, so I craeted one with # Use PHP5 as default
    AddHandler application/x-httpd-php5 .php
    as the only text in the file.

    When I attempt to install joomla onto the server, it checks the version and still using php4 even though I have php4 and 5 installed on the server.

    Any clue as to what I need to do to get my domain to recognize php5?

    Thanks in advance for anyones assistance.

    PD
     
Loading...

Share This Page