Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

script to remove cPanel-generated handler from htaccess

Discussion in 'EasyApache' started by whplus, Nov 26, 2018.

  1. whplus

    whplus Well-Known Member

    Joined:
    Dec 8, 2007
    Messages:
    77
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    Behind your business
    EA4 adding this stuff to many htaccess files. Is there any script to remove this from each htaccess at once?
    Code:
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php56” package as the default “PHP” programming language.
    <IfModule mime_module>
        AddType application/x-httpd-ea-php56 .php .php5 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,772
    Likes Received:
    93
    Trophy Points:
    353
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    That sets your php version you do not want to remove it

    I suppose you could build a bash script to remove them all and php would revert to inherent but I do not see the reason why you would want to.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,959
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @whplus,

    The entries in the .htaccess file make it possible for an individual cPanel user to change the version of PHP assigned to the account as part of the cPanel >> MultiPHP Manager feature and to ensure changes made through cPanel >> MultiPHP INI Editor are preserved if the handler changes in the future. You can read more about this at:

    MultiPHP INI Editor for cPanel - Version 74 Documentation - cPanel Documentation

    While it's technically possible to move the AddType entry from the .htaccess file to the individual virtual host, doing so is unsupported because other features such as PHP version detection via CLI rely on the entries in the .htaccess file.

    I encourage you to vote for the following feature request if you'd like to see these .htaccess entries moved elsewhere:

    Put PHP version choices in server configuration

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. whplus

    whplus Well-Known Member

    Joined:
    Dec 8, 2007
    Messages:
    77
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    Behind your business
    I use phpselector and apache mod_lsapi, so those stuff in htaccess break php. it is downloading php pages instead of displaying them.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,959
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi @whplus,

    Can you open a support ticket so we can take a closer look at your system to see why that's happening? You can post the ticket number here and we'll link this thread to it.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. whplus

    whplus Well-Known Member

    Joined:
    Dec 8, 2007
    Messages:
    77
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    Behind your business
    i guess it was coming from suphp/cPanelMultiPHP, but it's still there after switched to mod_lsapi/phpselector.
    i already used bash script to add comment (#) in front of 'AddType application/x-httpd-ea-php56' of each .htaccess
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,959
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @whplus

    Can you share the ticket number so I can take a look and update this thread with the outcome? While those .htaccess entries are populated, they should not result in a download prompt appearing when attempting to access a PHP file on systems using mod_lsapi.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice