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.

roundcube Error No. [501]

Discussion in 'General Discussion' started by sehh, Nov 25, 2011.

  1. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    I've recently recompiled Apache and PHP, which caused roundcube to stop working. When I try to access roundcube, I get the following error:

    SERVICE CURRENTLY NOT AVAILABLE!
    Error No. [501]

    So I traced it down to a single line of code. Apparently, the 501 error means that roundcube can't load its template, and I can see that clearly under /var/cpanel/roundcube/log/errors:

    PHP Error: Error loading template for login in /usr/local/cpanel/base/3rdparty/roundcube/program/include/rcube_template.php on line 418 (GET /3rdparty/roundcube/index.php)

    I looked at the code in rcube_template.php and found out that it fails when calling the function file_get_contents($path) were $path is "skins/default/templates/login.html"

    The file of course is there and I can even access it localy, even calling the roundcube index.php via the shell shows the login page correctly.

    So....

    1) What broke when I recompiled the latest versions of Apache+PHP?
    2) Since I am already logged into cPanel and typed my email password and I'm in the webmail selection page, why do I get redirected to the login page of roundcube? Previously it recognized that I am already logged in and I went directly to the inbox page.

    Please help.


    PS:
    I've already run /usr/local/cpanel/bin/update-roundcube --force but that didn't do anything, it seems to check that the database is correct.
     
  2. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    It seems like this could be related to the recent upgrade to roundcube 0.6.

    *edit*

    I've confirmed that the recent upgrade to roundcube 0.6 broke it and caused the 501 error.

    Since I can run the "index.php" via ssh and see a result, I am guessing that when running roundcube under cPanel, there are some restrictions that cause roundcube to fail, that don't exist when running the index.php file directly.

    Still investigating...

    *edit 2*

    I've done a lot more work to get to the bottom of this error. I added some debug code in the roundcube php scripts and I found out that the 501 error does indeed mean that roundcube can't load its template/skin.

    It can't load it because the "current" directory is not within roundcube, and roundcube is trying to load files based on the thinking that its within its own directory. So when it tries to load "skins/default/login.html" it fails because my debug output shows me that the current directory is not 3rdparty/roundcube but another directory (base or docroot, not sure which).

    Apparently, it is trying to load the "login.html" which IT SHOULDN'T!

    First of all, I've already logged into my cPanel and entered my password via the cPanel interface, so the issue is not really that roundcube can't load its template, but why is roundcube trying to show me the login page in the first place?

    I am guessing there is some session problem between cPanel and roundcube when it changed to version 0.6.

    Interestingly, it seems I am the only one having this problem... :(


    *edit 3*

    Small progress, I've confirmed that the problem is the way cPanel passes the user to roundcube. Apparently it must set the $_SESSION['user_id'] otherwise the user is redirected to the login page (which is broken and produces the 501 error).

    This happens in the cpanellogin.php plugin in roundcube, which handles the session.


    *edit 4*

    It seems like the problem is within cPanel, since the issue is before roundcube is called, because thats were the session variables should have been created.

    Forcing a reinstall of roundcube and running /upcp made no difference.


    *edit 5*

    I've re-installed roundcube and made sure the cpanel-specific patches have been applied correctly. I also deleted the sql database and re-created it (a similar error was due to a corrupt database). Unfortunately none of that made any difference.
     
    #2 sehh, Nov 25, 2011
    Last edited: Nov 26, 2011
  3. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    Ladies and Gentlemen, Madames et Monsieurs, Señoras y Señores:

    I am proud to announce and I have solved my problem.

    The issue was caused by "stale" files that haven't been updated by /scripts/upcp (even though it runs every night and its set to auto-update everything).

    So I had to force the whole process over and over again with "/scripts/upcp --force" until it finally updated all the relevant files.
     
  4. storminternet

    storminternet Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    462
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hi,

    That's great. Many more problems get solved with the cPanel update. So try it first before applying any solutions ;)
     
  5. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    True, I always run upcp to make sure everything is up to date, but in this case, something did NOT get updated and I had to force it to get it to update all the files (upcp --force).

    It's not like "upcp --force" is standard practice, even the default cronjob runs without --force. So it wasn't the first thing that would come to my mind, especially since the error message came from roundcube and it said that it couldn't load a template....
     
  6. spmetas

    spmetas Registered

    Joined:
    Mar 24, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hello,

    we spmetas.com got similar situation, and the problem was also Roundcube upgrade, but while we where using custom template from earlier version, this lead to Error 501, the old template was missing template files required for new version of roundcube. Solution was remastering template.

    I hope this will save some time for other ppl. Have a good day.
     
Loading...

Share This Page