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.

Temporary URLs in cPanel

Discussion in 'General Discussion' started by zaggs, Sep 29, 2011.

  1. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hi Guys!

    I have a problem when viewing a website on a temporary cPanel URL (e.g http://www.mydomain.com/~username). When I view the website on the temporary URL, I get errors (as shown below) all over the page. However, when I clear my browser cookies it works fine. Now, once on the website that now works fine (website 1), if I browse to another temporary cPanel URL (website 2) I get the same errors again.

    Any ideas how to resolve this? Is there a setting in WHM maybe?

    Code:
    Warning: session_start() [function.session-start]: open(/tmp/sess_66f76d22c6bc6402dc6d352ced42a4cd, O_RDWR) failed: Permission denied (13) in /home/username/public_html/includes/config.php on line 2
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/includes/config.php:2) in /home/username/public_html/includes/config.php on line 2
    
    Thanks in advance.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:

    Your site may be configured to use a domain name in this file. You might check there first. If the site is configured to use a domain name but you're not using one here, errors are the result. I'm guessing of course, but start there. :)
     
  3. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for your reply. Not sure what you mean by use a domain name; use a domain for what purpose? I do not believe the issue is programming related, because once the site is requested via the real URL (i.e. not the temporary cPanel url) it works perfectly fine with no errors.
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Can you please post line 2 of that config.php here?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    When you use Apache Mod_Userdir (ip_address/~user), you are running the script as the nobody user, instead of as the account user. Because of this, the script is creating files in /tmp owned by nobody, or 500, which it cannot open later. To avoid this, edit your hosts file on your workstation to point the domain name to the IP address, instead of using Apache Mod_Userdir to preview the website. Editing the hosts file will let you access the site by typing the domain name into the browser, and it will create session files with the correct ownerships in /tmp.

    Thank you.
     
  6. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hi - thanks for your reply. So, I need to edit the hosts file on my mac - not on the server, right?
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  8. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    I was actually previewing the website on an IP address, so what would I need to enter in the hosts file? An IP address pointing to where?
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Here is an example of an entry you could add to the hosts file on your computer:

    Code:
    IPAddress     yourdomain.com
    Simply replace "IPAddress" with the IP address that is assigned to the account.

    Thank you.
     
  10. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    This really doesn't make much sense to me. We are using the preview link on our server's IP address to show our clients their website in development. It would simply be impossible for me to add every single website to my hosts file on my laptop.

    Is there no other solution to this?

    In your first post, you say that the script is getting run as the nobody user. Would it be possible to run it as the account holder instead?

    I really need a fix to this.

    Please help.
     
  11. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Can anyone offer any advice on this at all?
     
  12. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    The easy answer is to use the domain name. If you like, send me a message with a link to one of the sites.
     
  13. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I've taken a look at the URLs sent to me. The script you're using joboardscripts has 3 different types of licenses. Going by the website for that script, the owned version is over $7,000 dollars. I'm going to assume you've got one of the other, less costly versions. You have no access to the Source code in either of those offerings. Only the 7,000 dollar version offers you full source code.

    If you open one of your sites, and place your mouse over a link, you see that the full domain name is being used.

    My guess, you're not going to be able to do what you want to do here with this script without using the full domain name. The script requires the full domain name to operate.

    This is not a cPanel issue, its an issue with the scripts you're using incorrectly.

    If I was to suggest anything, it would be to contact the folks over at joboardscripts and ask them if using relative URLs is possible. I bet its not.
     
  14. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    This in fact our own software company - so we can make what modifications are required. Would you be able to provide me with some further insight into what's causing the issue and I will get our developers to make the change.

    Thanks for your help.
     
  15. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Looking at the complexity of the sites, your developers should understand exactly what I mean.

    Assisting with something not cPanel related is out of the scope of these forums, my apologies.
     
  16. zaggs

    zaggs Member

    Joined:
    Dec 5, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Ok, I have just spoken with my developer and he says that the software is trying to save the session files in the default /tmp folder. And as the apache (nobody) user doesn't have permission to write to this folder I don't see this as an issue with our software. Surely this is a cPanel issue? Shouldn't the user be the account owner and therfore eradicating this problem?

    Please correct me if I am wrong?

    We can simply set something like this at the top of the config file in the software, but surely this shouldnt be necessary?

    PHP:
    session_save_path('/home/user/public_html/session');
     
  17. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    There are limitations to using mod_userdir (the temporary url), which have already been explained previously by Michael on the last page. The initial sessions are saved as nobody and that is why you can see the site without the warning messages initially but do not own the sessions when trying to view it a second time. This is exactly how mod_userdir functions under suPHP and the account owner does not own the sessions, since the account owner is not the actual user of the processes under mod_userdir. There is not a way around the issue for how the sessions are saved in /tmp under suPHP using mod_userdir.

    One option has already been provided to temporarily view the sites by modifying the hosts file if you do not wish to change the session_save_path. Since the temporary url is only intended to be temporary, then it would not be a long period of time when this would be used.
     
Loading...

Share This Page