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!

How to enable PHP in temporary URL in cPanel

Discussion in 'General Discussion' started by cavamondo, Jan 31, 2012.

  1. cavamondo

    cavamondo Member

    Joined:
    May 21, 2011
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    51
    How do i enable php in the temporary URL in cPanel. I need to able to use php to develop and implement php apps in the temporary URL = IP/~user ... before the TLD gets redirected.

    I have disabled mod_userdir Protection and non php files can be accessed just fine - but the php doesnt work. Any suggestion on how to fix this?

    /thx
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    PHP should function if you are using DSO, suPHP or CGI with mod_userdir allowed. If you are using FCGI, mod_userdir only works with suEXEC off. Of note, for PHP, includes do not work under mod_userdir due to how these are called.

    As such, what PHP handler are you using? You can see in WHM > Apache Configuration > PHP and SuExec Configuration area or by issuing this command in root SSH:

    Code:
    /usr/local/cpanel/bin/rebuild_phpconf --current
    If you are using DSO, CGI or suPHP and not FCGI, then what is the exact issue happening in PHP pages? If you are receiving an error message in a browser, please provide that error message. If it is simply a 404 Not Found or a 500 Internal Server Error, please provide the error listed in /usr/local/apache/logs/error_log location or at /home/username/public_html/error_log location where username is the cPanel username.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cavamondo

    cavamondo Member

    Joined:
    May 21, 2011
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    51
    Thx for reply.

    Config:
    - PHP 5.3.9
    - PHP5 Handler: fcgi
    - PHP4 Handler: fcgi
    - Apache suEXEC ON
    ...
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    As I stated, mod_userdir doesn't work with FCGI with suEXEC on. You won't be able to use it with your current PHP handler setup. There's no workaround for this other than the following:

    - Edit your local computer's hosts file (see Hosts (file) - Wikipedia, the free encyclopedia)
    - Create subdomains off the main server domain (the domain associated with the hostname) for each account to use prior to the domain being pointed to the machine
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cavamondo

    cavamondo Member

    Joined:
    May 21, 2011
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    51
    Thx for helping out.

    A bit of a predicament, cause some of the app needs suEXEC - and on the other hand i cant ask clients to mod their host file to access the temp website.

    Any suggestions how to do a work around, by setting up some proxy or cname records?
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I suggested a second workaround already:

    Again, you could create a subdomain for each new account that is a subdomain off the main domain on the machine. The subdomain would work until they point the DNS to the machine.

    CNAME records will not work as those only work for a dedicated IP unless you are planning to provide each account user with a dedicated IP. If you did provide a dedicated IP for each account, they could pull up the site on the dedicated IP. It's a lot more expensive to do that over just creating a subdomain off the main domain, though.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cavamondo

    cavamondo Member

    Joined:
    May 21, 2011
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    51
    Ok, so if cpanel server is www.myserver.com - and the domain i need to use temp is user=mytemp owning the website = mytempwebsite.com, i then create a subdomain mytemp.myserver.com or mytempwebsite.myserver.com?
     
    #7 cavamondo, Jan 31, 2012
    Last edited: Jan 31, 2012
  8. luigidelgado

    luigidelgado Well-Known Member

    Joined:
    Nov 6, 2010
    Messages:
    119
    Likes Received:
    5
    Trophy Points:
    68
    Location:
    Mexico
    cPanel Access Level:
    Root Administrator
    Twitter:
    Tristan,
    Just to confirm. Im in this situation too. I have FCGI and now I understand this is why I cant see temp URLs with the IP [xxx.xxx.xxx.xxx/~user/]

    So I should make SuEXEC off, but isnt this a big security risk/vulnerability?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is there a specific reason you prefer not to edit the hosts file on your own machine? This will allow you to access the website over the domain name itself before you update it's DNS. This is explained at the following URL:

    hosts (file) - Wikipedia, the free encyclopedia

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. luigidelgado

    luigidelgado Well-Known Member

    Joined:
    Nov 6, 2010
    Messages:
    119
    Likes Received:
    5
    Trophy Points:
    68
    Location:
    Mexico
    cPanel Access Level:
    Root Administrator
    Twitter:
    I will check that.
    I have tried:
    Removing FCGI, not working,
    FCGI with SuEXEC off, not working either.
    Removed NGINX tried with Apache, nothing.

    I will try to solve this using a testing domain. Faster and simple.

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I'm confused about the removing FCGI portion. You mean you changed from FCGI to another PHP handler? If so, which one?

    Also, what is not working specifically? You might not have mod_userdir allowed in WHM > mod_userdir protection. If you have it checked there to enable mod_userdir protection, that means you also cannot use mod_userdir and either have to allow some domains by checking them along with the user nobody, or you have to uncheck mod_userdir protection entirely.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. luigidelgado

    luigidelgado Well-Known Member

    Joined:
    Nov 6, 2010
    Messages:
    119
    Likes Received:
    5
    Trophy Points:
    68
    Location:
    Mexico
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes I didnt mean to "remove FCGI" just change it to SuPHP.

    And yes I tried that but missed the "nobody" user part... my bad.

    I ended up adding a domain and testing it this way which was OK. The new site migration was finished succesfully.
     
    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