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.

PHP downloading instead of executing only when in cgi-bin

Discussion in 'EasyApache' started by PMD, Feb 7, 2017.

  1. PMD

    PMD Registered

    Joined:
    Nov 14, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,

    I've just started a migration between two VPS's both running WHM/cPanel. There's only one site on this server so I backed up through the user account and restored in WHM. No probs there, everything went well.

    Aside from a small issue where the location of perl in some scripts was wrong (rectified by a symlink), everything else was fine except for PHP causing me nightmares for what is now a whole day trying and failing to remedy this.

    Essentially, PHP will execute absolutely fine anywhere but the cgi-bin directory. Annoyingly, because the site is somewhat legacy and I took weird choices 10 years ago, there are a lot of PHP files in the cgi-bin folder.

    The worrying thing is that is actually downloads them, code 'n' all rather than executes them.

    The old VPS with EasyApache3 and PHP5 worked fine and there has been no change in any of the files within the home directory to cause this, so it's something specific to Apache or PHP and I can't figure it out. The new VPS started life with EasyApache4 but I also tested on another migrating from 3 to 4 and it made no difference.

    I have tried all the AddHandlers and AddTypes in the world within .htaccess and in the main httpd.conf (using the includes editor in WHM). I have tried enabling more than just cgi (suphp for example) in MultiPHP manager and that makes no difference. The file permissions are fine. I can execute the same 'hello world' file outside of cgi-bin but just not inside it. I am at the end of my somewhat short tether now and any help would be majorly appreciated.
     
  2. mariusfv

    mariusfv Member

    Joined:
    Mar 24, 2013
    Messages:
    22
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    I had this error few days ago.
    The problem is about incompatibility.
    Try install packages via WHM->Easyapache 4 -> I recommend you choose default cPanel(prefork+php-fpm) and do not install other packages because you'll risk a lot of incompatibility between modules(Ex: suphp+mod_ruid2, etc).

    Do you have PHP-FPM installed?
    If yes: Go to WHM-> MultiPHP Manager and for desired domain select(check) -> activate PHP-FPM. By default PHP-FPM is Off if a PHP version is set to inherit, so must be activated by domain!
    Handlers does not apply to PHP-FPM!
     
  3. PMD

    PMD Registered

    Joined:
    Nov 14, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you so much. That did it. I'm so grateful!
     
  4. mariusfv

    mariusfv Member

    Joined:
    Mar 24, 2013
    Messages:
    22
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    I'm glad I could help you :)
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm happy to see you were able to find a suitable workaround.

    You may also want to consider making changes in the future to ensure the PHP scripts work outside of the cgi-bin, as the cgi-bin isn't intended for PHP scripts.

    Thank you.
     
Loading...

Share This Page