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.

Shared PHP folder all of a sudden prompting to download

Discussion in 'Workarounds and Optimization' started by Clint Decker, Apr 3, 2015.

  1. Clint Decker

    Clint Decker Member

    Joined:
    Oct 15, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Saratoga Springs, Utah, United States
    cPanel Access Level:
    Root Administrator
    I have a shared php directory where I stick some php files that I use on multiple sites (like a captcha image, html editor, etc).

    I have an Alias folder setup in my httpd.conf file like this:

    Alias /sys-images/ /home/****/shared-scripts/images/

    Then, on any site, I can access images and scripts by doing this:

    one_of_my_sites.com/sys-images/myimage.jpg

    Or...

    one_of_my_sites.com/sys-images/captcha.php

    All of a sudden, I think last night, or over the past couple days... any access to php files stopped working. (the images still work) It started prompting to download the file instead of executing it. I dont know what changed, but a whole bunch of stuff on the server doesnt work now.

    I changed the PHP 5 Handler from dso to suphp (since all my other servers are configured that way) and it didnt help.. now instead of prompting to download, it just gives an Error 500 premature script headers error.

    Does anyone know how I can fix this?
     
  2. Clint Decker

    Clint Decker Member

    Joined:
    Oct 15, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Saratoga Springs, Utah, United States
    cPanel Access Level:
    Root Administrator
    I changed it back to dso and the captcha image is working, but if I try to access a php file in the shared folder, its prompting the php file download. If I open it, you can see all the php code. This wasnt happening a week ago.

    Hoping someone has a suggestion soon, this is bad since people can now download my php files. :(
     
  3. Clint Decker

    Clint Decker Member

    Joined:
    Oct 15, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Saratoga Springs, Utah, United States
    cPanel Access Level:
    Root Administrator
    FIXED.

    All of a sudden, a .htaccess file appeared automatically in the folder with this in the contents:

    <IfModule mod_php4.c>
    php_value engine off
    </IfModule>
    <IfModule mod_php5.c>
    php_value engine off
    </IfModule>



    I never added this, it just appeared. :(

    I removed it and now it works.
     
  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,

    I am happy to see you were able to resolve the issue. Note that you may want to consider uploading a copy of those files to each account instead of sharing a directory, as sharing a directory is not always the most secure method of accessing files.

    Thank you.
     
  5. Clint Decker

    Clint Decker Member

    Joined:
    Oct 15, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Saratoga Springs, Utah, United States
    cPanel Access Level:
    Root Administrator
    So this problem keeps happening over and over. Randomly, a new .htaccess file is automatically created and it sticks this contents in the file:

    <IfModule mod_php4.c>
    php_value engine off
    </IfModule>
    <IfModule mod_php5.c>
    php_value engine off
    </IfModule>


    I dont know how its being created or why it keeps appearing. Any ideas?
     
  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
    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
Loading...

Share This Page