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 not working with site preview

Discussion in 'General Discussion' started by cweb, Sep 6, 2007.

  1. cweb

    cweb Member

    Joined:
    Dec 9, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    We have an apache2.2.4 server with suphp and php5.2.3 configured. When we try to access a new site before it is delegated via IP we are having issues with PHP code. HTML code is fine. Only PHP code is the issue.

    If we try to access http://serverip/~username/anything.php we get the following error:
    ****************
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    ****************

    The server error log has the following
    ****************
    SoftException in Application.cpp:214: File "/home/username/public_html/anything.php" is not in document root of Vhost "/usr/local/apache/htdocs", referer: http://servername/~username/
    ****************

    Any ideas?
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    I was wondering how cPanel was going to tackle this problem.

    When I looked at suPHP a few years ago, I ran into this problem as well. I did find some patches that I was able to apply and resolve this, but the patches do not work for the latest version of suPHP (at least that I could tell).

    The cPanel developers will need to patch their release of suPHP or something will need to change in regards to their set up. suPHP is designed to have an open_basedir like protection built-in. It looks to see what the DocumentRoot for a specific VirtualHost is and if the PHP script that is being accessed is not within that DocumentRoot, then it returns the exception.

    With the main server's virtualhost, the DocumentRoot is set to /usr/local/apache/htdocs and the PHP files you are trying to access are in the /home partition, which do not match, causing this exception.

    The suphp included with cPanel would need to be patched to bypass this security feature or make some other type of arrangement.

    It's not really a cPanel problem and it's not really a suPHP problem. Its just a case to where we have come to expect to be able to use this url syntax to check a website before the DNS propagates. suPHP is expecting you to access the VirtualHost directly, in which case the PHP files will work.
     
  3. sparkleisp

    sparkleisp Member

    Joined:
    May 31, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Is there a workarround available for this problem?
     
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    When I tested this a couple of weeks ago on a test machine with suPHP and Apache2, this worked. That is PHP script that were accessed by http://ip/~username worked and were executed by username.
     
  5. sparkleisp

    sparkleisp Member

    Joined:
    May 31, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Here it shows 404 errors :)
     
  6. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    You probably have mod_userdir protection enabled and don't have the defaulthost excluded, this was changed a few releases ago.

    Log into root's WHM. Click on Security Center, then click on Apache mod_userdir Tweak.

    If Enable mod_userdir Protection is checked, try checking the Exclude for DefaultHost (nobody).

    Alternatively you can just add the user that you are trying to preview into the Additional Users textbox.
     
  7. EWD

    EWD Well-Known Member
    PartnerNOC

    Joined:
    Aug 19, 2003
    Messages:
    165
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    NY
    I have done this and still get a 404 error.

    Any ideas?

    Thanks
     
  8. Sindorf

    Sindorf Member

    Joined:
    Aug 3, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I think this is configured via mod_suphp

    Log in to shell and write

    and check for

    I think the comments on the configuration file is enough ;)

    Happy new year :)

    P.S. You can use nano or vi for editing, if you do not have pico installed.
     
    #8 Sindorf, Jan 1, 2008
    Last edited: Jan 1, 2008
  9. Morry

    Morry Member

    Joined:
    Aug 8, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    i face this problem with my cpanel 11 server
    (centos ) with apache 1.3.39 with php 4.4.7 - Selinux Desaibled

    and i searched for this file /opt/suphp/etc/suphp.conf
    in my server i diden't find it

    and my /opt/ is empty

    did you have any idea where can i find this file suphp.conf
     
  10. darren.nolan

    darren.nolan Well-Known Member

    Joined:
    Oct 4, 2007
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    16
    Mine is at /opt/suphp/etc/suphp.conf

    Try using
    Code:
    locate suphp.conf
    (If your system supports it)
     
  11. Morry

    Morry Member

    Joined:
    Aug 8, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    thnx very much
     
Loading...

Share This Page