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.

User choose php4 or php5

Discussion in 'General Discussion' started by dan223, Dec 17, 2007.

  1. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    We have installed easy apache 2.2 with php5 using dso and php4. Looking at the documentation, there is suppose to be an option in cPanel under software/services > php configuration.

    So when I go to that page in cPanel i get:

    These PHP configuration settings are customizable by the server administrator. They are listed for reference only.

    However in the documentation it says that a user will be given a selection:

    When PHP 4 and PHP5 are both enabled and served using the CGI, DSO, or SUPHP configurations, the Cpanel interface will contain a selector for setting the version of PHP that will act as the default for the account. The version of PHP selected will process .php files for all domains assigned to the account.

    The interface is available on the X3 theme under Software/Services -> PHP Configuration. Available settings are PHP4, PHP5, and System Default. The chosen value is reflected in the .htaccess file in the user's home directory. If the user requires that file extensions other than .php are processed by the selected version of PHP, add those file extensions after .php to the AddHandler line in the .htaccess file.


    Which in cPanel im not given any option, is there somewhere I need to enable this? I am running the latest stable build.
     
  2. darren.nolan

    darren.nolan Well-Known Member

    Joined:
    Oct 4, 2007
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    16
    .htaccess file in the user's public_html is the easiest way to do this.

    Just add the following line to start using PHP5, if your default is PHP4 on the server;

    AddHandler application/x-httpd-php5 .php


    Strange that you wouldn't have it in cPanel - I have (you must be in the X3 theme, not x or x2) "PHP Configuration".

    You can pick system default, or change it to PHP4 or PHP5 from the drop down box. I've never even seen it there before. Always a .htaccess kind of guy.
     
    #2 darren.nolan, Dec 17, 2007
    Last edited: Dec 17, 2007
  3. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    I understand that, however I thought there was suppose to be a way that users could press one button to change this via cPanel, as thats what it says in the documentation.

    Also what would I use for php4 I have tried using
    AddHandler application/x-httpd-php4 .php

    However when loading a php file it asks me to download it
     
    #3 dan223, Dec 17, 2007
    Last edited: Dec 17, 2007
  4. BlueZebra

    BlueZebra Well-Known Member

    Joined:
    Apr 27, 2006
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    Which version of Cpanel are you running? Also have you compiled both PHPs using easy apache?
     
  5. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    WHM 11.11.0 cPanel 11.16.0-S18450

    I have compiled both php 4 and php 5, php 5 is the default using dso. php 4 is none.
     
  6. darren.nolan

    darren.nolan Well-Known Member

    Joined:
    Oct 4, 2007
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    16
    Strange - it's what I have.

    What version of WHM are you using? If it's asking you to download it, is it possible that apache doesn't have a handler for version 4? Or is version 4 your default?

    Edit: Nevermind, BlueZebra beat me to the question. Happens when you watch movies while trolling I guess
     
  7. BlueZebra

    BlueZebra Well-Known Member

    Joined:
    Apr 27, 2006
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    I have never find it in users' cpanel. Rather it says in Cpanel >> Software/Services >>PHP Configuration that "These PHP configuration settings are customizable by the server administrator. They are listed for reference only."
    WHM >> PHP Configuration editor is the place to change it (server wide)
     
  8. darren.nolan

    darren.nolan Well-Known Member

    Joined:
    Oct 4, 2007
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    16
    In that area my users can change from PHP4 to PHP5 and vice versa.
    WHM 11.11.0 cPanel 11.15.0-E18347
     
  9. kinsky

    kinsky Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    User can change their default php for each directory using .htaccess (both php is compiled as CGI)
     
  10. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    So could that be why? On the end of the build php5 said dso and the other said none, so i just accepted it. Should i put both a cgi?
     
  11. kinsky

    kinsky Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Its depend on your needs.. running PHP as CGI is consume more resources (as i know) but i have to do that because there is a several client still need PHP 4 and other want to use PHP 5.

    So i use custom php compilation for both of them and put two lines in each user .htaccess like :

    #unmark to set default PHP
    AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml
    #AddHandler application/x-httpd-php4 .php .php4 .php3 .phtml


    regards
     
  12. jdlightsey

    jdlightsey Perl Developer III
    Staff Member

    Joined:
    Mar 6, 2007
    Messages:
    126
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Houston Texas
    cPanel Access Level:
    Root Administrator
    The text above indicates why it's not showing in the interface:

    "When PHP 4 and PHP5 are both enabled and served using the CGI, DSO, or SUPHP configurations..."

    Both versions of PHP have to be turned on in the WHM PHP & Suexec configuration tool and you can't be using mod_fcgid to handle either one.
     
  13. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Cheers, that was the problem!
     
Loading...

Share This Page