Roundcube problem, AJAX popup: An error occurred! Server Error! (Internal Server Error)

Discussion in 'ISPConfig 3 Priority Support' started by etruel, Feb 8, 2021.

  1. etruel

    etruel Member HowtoForge Supporter

    Hello there,

    I tried a lot of things trying to solve this, but I've run out of alternatives to test.
    I got a complaint of rejected emails from Gmail, and it seems I have some problems with PTR records.

    So I went into the webmail to try to test sending an email and I got this error. The actions I've tested to fire the AJAX call are action=autocomplete and action=refresh
    Captura de Pantalla 2021-02-07 a la(s) 20.39.45.png

    Everything seems to point to a php error when trying to get the contact lists or checking email.
    I've tested with accounts of two domains and also logged in at server1...:8080/webmail
    Captura de Pantalla 2021-02-07 a la(s) 20.53.29.png
    (In this screen I can see the Content Security Policy that is not in the single domain/webmail. I don't think that is related to the error, but I can be wrong.)

    The server is a fresh installation of The Perfect Server - Debian 10 (Buster) with Apache, BIND, Dovecot, PureFTPD and ISPConfig 3.1
    ISPConfig upgraded to 3.2.2

    I did remove --purge of the whole Roundcube and installed it again with the steps of the previous tutorial, and it does the same thing. So I think the problem may be related to apache or the PHP used or even file permissions, but I checked quite a bit and I don't see anything unusual.

    I have installed the PHP package from SURY with these steps
    https://www.howtoforge.com/tutorial...fig-3-from-debian-packages-on-debian-8-and-9/
    Captura de Pantalla 2021-02-07 a la(s) 20.09.18.png


    ISPConfig test script
    attached as htf_report.txt

    /etc/apache2/conf-available/roundcube.conf
    Code:
    root@server1:/etc/apache2/conf-available# cat roundcube.conf
    # Those aliases do not work properly with several hosts on your apache server
    # Uncomment them to use it or adapt them to your configuration
    #    Alias /roundcube /var/lib/roundcube
    Alias /roundcube /var/lib/roundcube
    Alias /webmail /var/lib/roundcube
    
    <Directory /var/lib/roundcube/>
      Options +FollowSymLinks
      # This is needed to parse /var/lib/roundcube/.htaccess. See its
      # content before setting AllowOverride to None.
      AllowOverride All
      <IfVersion >= 2.3>
        Require all granted
      </IfVersion>
      <IfVersion < 2.3>
        Order allow,deny
        Allow from all
      </IfVersion>
    </Directory>
    
    # Protecting basic directories:
    <Directory /var/lib/roundcube/config>
            Options -FollowSymLinks
            AllowOverride None
    </Directory>
    
    <Directory /var/lib/roundcube/temp>
            Options -FollowSymLinks
            AllowOverride None
            <IfVersion >= 2.3>
              Require all denied
            </IfVersion>
            <IfVersion < 2.3>
              Order allow,deny
              Deny from all
            </IfVersion>
    </Directory>
    
    <Directory /var/lib/roundcube/logs>
            Options -FollowSymLinks
            AllowOverride None
            <IfVersion >= 2.3>
              Require all denied
            </IfVersion>
            <IfVersion < 2.3>
              Order allow,deny
              Deny from all
            </IfVersion>
    </Directory>
     

    Attached Files:

    Last edited: Feb 8, 2021
  2. etruel

    etruel Member HowtoForge Supporter

    updated with last lines of /var/lib/roundcube/logs/errors
    Code:
    (Lot of PHP Warning:  Undefined array key "xxx" before)
    [07-Feb-2021 16:31:43 America/Los_Angeles] PHP Warning:  Undefined array key "mail" in /usr/share/roundcube/program/lib/Roundcube/rcube_plugin_api.php on line 590
    [07-Feb-2021 16:31:43 America/Los_Angeles] PHP Warning:  Undefined variable $add in /usr/share/roundcube/program/lib/Roundcube/rcube_db.php on line 936
    [07-Feb-2021 16:31:43 America/Los_Angeles] PHP Warning:  Uninitialized string offset 58 in /usr/share/roundcube/program/lib/Roundcube/rcube_db.php on line 438
    [07-Feb-2021 16:31:43 America/Los_Angeles] PHP Fatal error:  Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, null given in /usr/share/roundcube/program/lib/Roundcube/rcube_imap_generic.php:397
    Stack trace:
    #0 /usr/share/roundcube/program/lib/Roundcube/rcube_imap_generic.php(397): fclose()
    #1 /usr/share/roundcube/program/lib/Roundcube/rcube_imap_generic.php(1089): rcube_imap_generic->closeSocket()
    #2 /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php(215): rcube_imap_generic->closeConnection()
    #3 /usr/share/roundcube/program/lib/Roundcube/rcube.php(1024): rcube_imap->close()
    #4 /usr/share/roundcube/program/include/rcmail.php(883): rcube->shutdown()
    #5 [internal function]: rcmail->shutdown()
    #6 {main}
      thrown in /usr/share/roundcube/program/lib/Roundcube/rcube_imap_generic.php on line 397
    root@server1:/var/lib/roundcube/logs# 
     
  3. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    The error 500 and the PTR issue are separate problems. Let's start with the PTR issue.

    You need a PTR record for the IPs you are sending from. This has to be set with your network provider.
     
    etruel likes this.
  4. etruel

    etruel Member HowtoForge Supporter

    Thanks Th0m. Just received the answer of the network provider, and it's on the way.
    Error 500 is my hurry now to allow receiving and sending emails by webmail.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Probably you accidentally upgraded mod_php to PHP 8, as RoundCube is run by mod_php. Try:

    Code:
    a2dismod php8.0
    a2enmod php7.3
    service apache2 restart
     
    etruel and Th0m like this.
  6. etruel

    etruel Member HowtoForge Supporter

    Hello till,
    I think the problem is on that way.
    Anyway php7.3 was already active, but it gives a couple of conflicts to consider that I don't know if are related to the problem.
    I attach below the console outputs. I always get those perl: warning from the locale.
    Also attached php7.3.conf. Tell me if I can add info more useful.

    php7.3.conf
    Code:
    root@server1:/etc/apache2/mods-enabled# cat php7.3.conf
    <FilesMatch ".+\.ph(ar|p|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch ".+\.phps$">
        SetHandler application/x-httpd-php-source
        # Deny access to raw php sources by default
        # To re-enable it's recommended to enable access to the files
        # only in specific virtual host or directory
        Require all denied
    </FilesMatch>
    # Deny access to files without filename (e.g. '.php')
    <FilesMatch "^\.ph(ar|p|ps|tml)$">
        Require all denied
    </FilesMatch>
    
    # Running PHP scripts in user directories is disabled by default
    #
    # To re-enable PHP in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_flag engine Off
        </Directory>
    </IfModule>
    
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Code:
    Considering conflict php5 for php7.3:
    Do you have php5 and php7.3 enabled? In this case, run:

    a2dismod php5

    and restart apache.

    There can only be one version enabled as mod_php module in apache.

    and regarding Apache MPM module, the perfect server setups all use mpm_prefork as other modes don't support mod_php. Did you change to a different mpm? You can change the mpm, but then you can't use mod_php and have to configure e.g. php_fpm as base php handler.
     
    etruel likes this.
  8. etruel

    etruel Member HowtoForge Supporter

    Only mod enable is php7.3. Available are php7.3 php7.4 php8.0

    ERROR: Module php5 does not exist!

    I'm not really sure what is this. I've just followed the tutorials I said in first post.

    The perfect server first, then How to install PHP 5.6 and 7.0 - 7.4 as PHP-FPM & FastCGI for ISPConfig 3.1 with apt on Debian 8 to 10

    -->Plus this tutorial of multiple PHP, I copy the item 5.6 Install PHP 7.4...
    Code:
    apt-get install php7.4 php7.4-cli php7.4-cgi php7.4-fpm php7.4-gd php7.4-mysql php7.4-imap php7.4-curl php7.4-intl php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-zip php7.4-mbstring php7.4-soap php7.4-opcache libonig5 php7.4-common php7.4-json php7.4-readline php7.4-xml
    ...and replaced all to 8.0 to install php8.0, after a couple of issues with packages I could install it... I remember some problems with acpu module.
    I've also did apt-get install --reinstall of item '5.5 Install PHP 7.3' and items 7 and 8 for optional extensions

    About Considering dependency and Considering conflict, I could see in .load files these things
    I'm really lost here. I don't know what can I do or what can I test.
     
  9. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    That is correct to have more than one mpm module available - you need to see which one is enabled. Look under the mods-enable directory or try `apachectl -M | grep mpm`.
     
  10. etruel

    etruel Member HowtoForge Supporter

    Thanks Jesse Norell,
    Just mpm_prefork is enabled. I think that's ok, right ?

    The output is
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Please create a file:

    /usr/share/roundcube/info.php

    with this content:

    Code:
    <?php
    phpinfo();
    and open it in a browser:

    http://yourserver/roundcube/info.php

    so you can see which php version roundcube is using. Don't forget to delete the file afterwards.

    If the PHP version is ok, then there might be a config issue in the roundcube config file or maybe there is a general issue with the imap daemon.
     
    etruel likes this.
  12. etruel

    etruel Member HowtoForge Supporter

    Hi till,
    That was quite informative, and I found a couple of problems.
    First I had certificate problems on the server url, but not on the domain, then I’ve created an empty website in ISPConfig with the name of the server to give it the Let’s encrypt certificates.

    Then I’ve created /usr/share/roundcube/info_.php and I get “File not found.” with https://server/roundcube/info_.php

    Then I created /var/lib/rouncube/info.php and works well with https://server/roundcube/info.php and also with https://thedomain/roundcube/info.php

    This is the weird:
    It’s showing PHP Version 8.0.1
    I think this should be the problem.


    As I showed before I’ve selected php7.3 with update-alternatives
    And I’ve tried also update-alternatives --set php /usr/bin/php7.3
    phpinfo don’t change the version.

    BTW also test with php8 and enabling its mod
    a2dismod php7.3
    a2enmod php8.0

    (service apache2 restart was also done in each test)

    Finally, I set all to 7.3 but never change, always use PHP Version 8.0.1
    Then I assume that the thing is change to 7.3 by default, but I’m “googling” if exists another way of update-alternatives method.

    I don't know, should I uninstall all php and install them again ?
     
  13. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Try
    Code:
    sudo a2dismod php8.0
    sudo a2enmod php7.3
    systemctl restart apache2
     
  14. etruel

    etruel Member HowtoForge Supporter

    Hi Th0m, thanks
    till send me the same before, and I've posted the results after his post above
    https://www.howtoforge.com/communit...rror-internal-server-error.86323/#post-417803

    Anyway the outputs, now with 'sudo'just in case
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    ls /etc/apache2/conf-enabled/

    and

    ls /etc/apache2/mods-enabled/
     
  16. etruel

    etruel Member HowtoForge Supporter

    I did the following and the phpinfo change to PHP Version 7.3.26-1+0~20210112.74+debian10~1.gbpd78724
    But I don't know if this is OK to be disabled.
    With the change of the PHP version I'm not getting the ajax error on autocomplete or refresh but on try to send I get
    SMTP Error (220): Authentication failed.
     
  17. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Sounds like you have a working php setup, now you just need to configure roundcube, eg. use tls on port 587 or switch to port 25.
     
    etruel likes this.
  18. etruel

    etruel Member HowtoForge Supporter

    Yes, it is. That was the problem. It solved now. Thanks till and all staff members. Guys you're the best.

    BTW, for SMTP Error (220): Authentication failed I've changed /etc/roundcube/config.inc.php
    $config['smtp_server'] = 'tls://%h'; --> $config['smtp_server'] = '';

    All seems to be working now.
    Thanks!!
     

Share This Page