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.

Find out which version of PHP each account is using?

Discussion in 'General Discussion' started by willke, Nov 13, 2012.

  1. willke

    willke Well-Known Member

    Joined:
    Mar 30, 2005
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    We have a server with 200 accounts which runs both PHP4 and PHP5. Other than by going through each Cpanel account and checking one by one, is there any quick way to list which accounts are running on each version of PHP?

    Thanks.

    Will.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    The version of PHP used for an account is defined in the .htaccess file. For example, the line used to enable PHP 4 is:

    Code:
    AddHandler application/x-httpd-php4 .php
    Thus, you could search the .htaccess files for "php4" with a command such as:

    Code:
    # find /home*/*/public_html/ -mindepth 1 -iname "\.htaccess" -type f -exec grep -Hi "php4" '{}' \;
    Thank you.
     
  3. willke

    willke Well-Known Member

    Joined:
    Mar 30, 2005
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Thanks, Michael.

    However, I've checked a couple of accounts I know are running under php4 and the .htaccess under root says this ...

    ==
    AddHandler application/x-httpd-php .php
    ==

    In php5 sites, there doesn't seem to be a .htaccess under root ?

    btw, there's no mention of "AddHandler application/x-httpd-php" in .htaccess in public

    Will
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Feel free to submit a support ticket and we can take a closer look to determine why your accounts that use PHP 4 are not using the standard .htaccess rules:

    Submit A Ticket

    You can post the ticket number here so we can track the issue.

    Thank you.
     
  5. willke

    willke Well-Known Member

    Joined:
    Mar 30, 2005
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Now done, thanks :)
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Per the ticket you opened, a better command for your particular server would be:

    Code:
    # find /home*/*/ -mindepth 1 -iname "\.htaccess" -type f -exec grep -Hi "Use PHP4 as default" '{}' \;
    cPanel adds "# Use PHP4 as default" above the "AddHandler" entry when a user selects PHP 4 as their PHP handler in cPanel.

    Thank you.
     
  7. willke

    willke Well-Known Member

    Joined:
    Mar 30, 2005
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Thanks again :)
     
Loading...

Share This Page