WHMCS migration issues

Discussion in 'ISPConfig 3 Priority Support' started by Honza, Dec 1, 2016.

  1. Honza

    Honza Member HowtoForge Supporter

    Hi,
    I tried to migrate from the current webhosting to my VPS running ISPConfig 3.0.5.4.p9 + Debian 8 the WHMCS script which was previously running on same servers.example.com subdomain (example.com used as an example) and I'm getting ERROR 500 when trying to load the homepage.
    While I was running PHP-FPM Apache log was like this (the full IPs are obfuscated with XX):
    Code:
    [Thu Dec 01 03:23:25.228769 2016] [core:error] [pid 3847] [client 103.XX.XX.XX:48401] AH00524: Handler for fastcgi-script returned invalid result code 1
    [Thu Dec 01 04:03:50.801302 2016] [fastcgi:error] [pid 5108] (104)Connection reset by peer: [client 61.XX.XX.XX:10015] FastCGI: comm with server "/var/www/clients/client1/web29/cgi-bin/php5-fcgi-185.XX.XX.XX-80-servers.example.com" aborted: read failed
    [Thu Dec 01 04:03:50.801392 2016] [fastcgi:error] [pid 5108] [client 61.XX.XX.XX:10015] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client1/web29/cgi-bin/php5-fcgi-185.XX.XX.XX-80-servers.example.com"
    [Thu Dec 01 04:13:53.424142 2016] [fastcgi:error] [pid 5704] (104)Connection reset by peer: [client 61.XX.XX.XX:10120] FastCGI: comm with server "/var/www/clients/client1/web29/cgi-bin/php5-fcgi-185.XX.XX.XX-80-servers.example.com" aborted: read failed
    [Thu Dec 01 04:13:53.424282 2016] [fastcgi:error] [pid 5704] [client 61.XX.XX.XX:10120] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client1/web29/cgi-bin/php5-fcgi-185.XX.XX.XX-80-servers.example.com"
    [Thu Dec 01 04:13:55.659157 2016] [fastcgi:error] [pid 5709] (104)Connection reset by peer: [client 61.XX.XX.XX:10122] FastCGI: comm with server "/var/www/clients/client1/web29/cgi-bin/php5-fcgi-185.XX.XX.XX-80-servers.example.com" aborted: read failed
    [Thu Dec 01 04:13:55.659285 2016] [fastcgi:error] [pid 5709] [client 61.XX.XX.XX:10122] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client1/web29/cgi-bin/php5-fcgi-185.XX.XX.XX-80-servers.example.com"
    Later I tried to change the PHP to Fast-CGI and Apache log became like this:
    Code:
    [Thu Dec 01 04:18:15.757821 2016] [fcgid:warn] [pid 5974] (104)Connection reset by peer: [client 103.XX.XX.XX:60097] mod_fcgid: error reading data from FastCGI server
    [Thu Dec 01 04:18:15.757929 2016] [fcgid:warn] [pid 5974] (104)Connection reset by peer: [client 103.XX.XX.XX:60097] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
    [Thu Dec 01 04:22:14.716093 2016] [fcgid:warn] [pid 6179] (104)Connection reset by peer: [client 103.XX.XX.XX:32979] mod_fcgid: error reading data from FastCGI server
    [Thu Dec 01 04:22:14.716284 2016] [fcgid:warn] [pid 6179] (104)Connection reset by peer: [client 103.XX.XX.XX:32979] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
    The WHMCS technical support said that it's likely caused by FcgidBusyTimeout value in my Apache configuration - they didn't say what it should be but I was hoping for something like 1800 should do.

    Can you please help me:
    1) Locate the right Apache file and adjust the configuration within my ISPConfig.
    2) Provide opinion if the error can be caused by something else as well (WHMCS tech support was not very helpful and it took a lot of effort to get this one advice from them).

    Thank you very much in advance!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I never used WHMCS, so I can not tell you anything about it's requirements or the config files that it uses. If you installed whmcs inside a website that you created in ispconfig, then you can set the value for FcgidBusyTimeout in the apache directives field of the website. Or you edit the vhost configuration file in /etc/apache2/sites-enabled/ temporarily and restart apache.

    What you should try is that you test if php in that website is working at all, e.g. by adding a info.php file with this content into the website:

    <?php
    phpinfo();
    ?>

    then open the info.php file in a browser, it should show you the phpinfo output with all php settings. Don't forget to remove that file after the test.
     
  3. Honza

    Honza Member HowtoForge Supporter

    Hi Till,
    thanks for quick reply - about 10x faster than from WHMCS - always happy to renew my subscription! (In all seriousness).

    Yes I created a site in ISPConfig - I already host about a dozen Wordpress sites on this VPS - the webhosting was supposed to be shortcut to "out of the box working solution" which was not - I have understanding how to use the ISPConfig - been doing so since 2012 (very happy user!). PHP info site with the above mentioned code works just fine. The VPS has plenty of resources - about 2.5 GB of RAM free and plenty of diskspace left.

    Where do I exactly insert the the FcgidBusyTimeout ?
    Is it here just above the </IfModule>?
    Code:
     # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
                    <IfModule mod_fcgid.c>
                                    IdleTimeout 300
                                    ProcessLifeTime 3600
                                    # MaxProcessCount 1000
                                    DefaultMinClassProcessCount 0
                                    DefaultMaxClassProcessCount 100
                                    IPCConnectTimeout 3
                                    IPCCommTimeout 600
                                    BusyTimeout 3600
                    </IfModule>
     
    till likes this.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. But what you should try first:

    Go to system > Server config > FastCGI. On that page you find at the end a option for fastcgi syntax, set this to use the newer syntax. Then go to the website and change a value, e.g. quota, and press save. Then wait a minute and try if this changes something. When you look at the vhost config file now, you will see that the fcgi settings have a slightly different syntax. If the syntax chane did not help, try to add the line before the closing ifmodule and restart apache.

    I must admit that I have some doubts that this will fix it as the defaukts work with all kind of cms and shop systems and shop systems can be realy slow, so whmcs must be really really slow in answering requests if it does not work with the defaults.

    Does all requests to whmcs fail or just some requests? Did you try to use mod_php (which should not be used in genaral) but it might give aou a more useful error message in case that there is a config problem in whmcs.

    The files and folders inside the web directory are all owned by the web user and client group of this website, right?
     
  5. Honza

    Honza Member HowtoForge Supporter

    I tried - unfortunately it didn't help :(

    No idea why they recommended this to be honest but when it jumps in fraction of second to ERROR 500 it doesn't seem like timeout issue.

    It fails on all requests - opening http://servers.example.com/admin fails on ERROR 500 too
    mod_php change the behaviour a little:
    Code:
    [Thu Dec 01 10:49:57.955451 2016] [fcgid:warn] [pid 19700] (104)Connection reset by peer: [client 103.XX.XX.XX:60174] mod_fcgid: error reading data from FastCGI server
    [Thu Dec 01 10:49:57.955540 2016] [core:error] [pid 19700] [client 103.XX.XX.XX:60174] End of script output before headers: index.php
    [Thu Dec 01 10:51:21.229112 2016] [:error] [pid 19965] [client 103.XX.XX.XX:60504] PHP Warning:  WHMCS\\Config\\Application::loadConfigFile(/var/www/clients/client1/web29/web/configuration.php): failed to open stream: Permission denied in /var/www/clients/client1/web29/web/includes/classes/WHMCS/Config/Application.php on line 0
    [Thu Dec 01 10:51:21.229346 2016] [:error] [pid 19965] [client 103.XX.XX.XX:60504] PHP Warning:  WHMCS\\Config\\Application::loadConfigFile(/var/www/clients/client1/web29/web/configuration.php): failed to open stream: Permission denied in /var/www/clients/client1/web29/web/includes/classes/WHMCS/Config/Application.php on line 0
    [Thu Dec 01 10:51:21.229530 2016] [:error] [pid 19965] [client 103.XX.XX.XX:60504] PHP Warning:  WHMCS\\Config\\Application::loadConfigFile(/var/www/clients/client1/web29/web/configuration.php): failed to open stream: Permission denied in /var/www/clients/client1/web29/web/includes/classes/WHMCS/Config/Application.php on line 0
    [Thu Dec 01 10:51:21.229568 2016] [:error] [pid 19965] [client 103.XX.XX.XX:60504] PHP Warning:  WHMCS\\Config\\Application::loadConfigFile(): Failed opening '/var/www/clients/client1/web29/web/configuration.php' for inclusion (include_path='/var/www/clients/client1/web29/web/vendor/phpseclib/phpseclib/phpseclib:.:/usr/share/php:/usr/share/pear') in /var/www/clients/client1/web29/web/includes/classes/WHMCS/Config/Application.php on line 0
    [Thu Dec 01 11:00:37.928801 2016] [fcgid:warn] [pid 20284] (104)Connection reset by peer: [client 103.XX.XX.XX:33227] mod_fcgid: error reading data from FastCGI server
    [Thu Dec 01 11:00:37.928893 2016] [fcgid:warn] [pid 20284] (104)Connection reset by peer: [client 103.XX.XX.XX:33227] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
    [Thu Dec 01 11:03:58.168749 2016] [fcgid:warn] [pid 20732] (104)Connection reset by peer: [client 103.XX.XX.XX:33560] mod_fcgid: error reading data from FastCGI server
    [Thu Dec 01 11:03:58.168821 2016] [fcgid:warn] [pid 20732] (104)Connection reset by peer: [client 103.XX.XX.XX:33560] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
    
    Following up on this I adjusted the permissions on configuration.php from WHMCS recommended "400" to ISPConfig typical "644" and the error disappeared but the site wouldn't load anyway.

    I did recursive update on the default following this:
    Source: http://docs.whmcs.com/Installing_WHMCS#Installing_WHMCS

    ------------------------------------------------
    ------------------------------------------------
    Here are the requirements: http://docs.whmcs.com/Version_6.x_System_Requirements

    When I did the VPS installation I followed exactly this: https://www.howtoforge.com/tutorial/perfect-server-debian-8-jessie-apache-bind-dovecot-ispconfig-3/
    For Ioncube loader I used: https://www.howtoforge.com/tutorial/how-to-install-ioncube-loader/

    Maybe follow up questions:
    3) In the requirements it says: "Ioncube Loaders: 4.7.5"
    When I do: php -v
    It shows:
    Code:
    /tmp/ioncube# php -v
    PHP 5.6.27-0+deb8u1 (cli) (built: Oct 15 2016 15:53:28)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
      with XCache v3.2.0, Copyright (c) 2005-2014, by mOo
      with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v6.0.6, Copyright (c) 2002-2016, by ionCube Ltd.
      with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
      with XCache Optimizer v3.2.0, Copyright (c) 2005-2014, by mOo
      with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
      with XCache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo
    I suppose the v6.0.6 is backwards compatible with the required 4.7.5 version? If there was an issue regarding Ioncube loader it would not give ERROR 500, right? If I need to use the 4.7.5 version how do I match it to my PHP 5.6 version?
    4) If my Ioncube loader is wrong which version do I need?
    If I wget and unpack: wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
    I will get:
    Code:
    /tmp/ioncube# ls -l
    total 22712
    -rw-rw-r-- 1 507 507  463328 Oct 26 08:36 ioncube_loader_lin_4.1.so
    -rw-rw-r-- 1 507 507  462912 Oct 26 08:37 ioncube_loader_lin_4.2.so
    -rw-rw-r-- 1 507 507  463520 Oct 26 08:37 ioncube_loader_lin_4.3.so
    -rw-rw-r-- 1 507 507  482624 Oct 26 08:37 ioncube_loader_lin_4.3_ts.so
    -rw-rw-r-- 1 507 507  466592 Oct 26 08:37 ioncube_loader_lin_4.4.so
    -rw-rw-r-- 1 507 507  482624 Oct 26 08:37 ioncube_loader_lin_4.4_ts.so
    -rw-rw-r-- 1 507 507  475712 Oct 26 08:38 ioncube_loader_lin_5.0.so
    -rw-rw-r-- 1 507 507  488992 Oct 26 08:38 ioncube_loader_lin_5.0_ts.so
    -rw-rw-r-- 1 507 507 1095488 Oct 26 08:38 ioncube_loader_lin_5.1.so
    -rw-rw-r-- 1 507 507 1136512 Oct 26 08:39 ioncube_loader_lin_5.1_ts.so
    -rw-rw-r-- 1 507 507 1136032 Oct 26 08:39 ioncube_loader_lin_5.2.so
    -rw-rw-r-- 1 507 507 1174816 Oct 26 08:39 ioncube_loader_lin_5.2_ts.so
    -rw-rw-r-- 1 507 507 1368648 Oct 26 08:40 ioncube_loader_lin_5.3.so
    -rw-rw-r-- 1 507 507 1432136 Oct 26 08:41 ioncube_loader_lin_5.3_ts.so
    -rw-rw-r-- 1 507 507 1509352 Oct 26 08:41 ioncube_loader_lin_5.4.so
    -rw-rw-r-- 1 507 507 1591144 Oct 26 08:42 ioncube_loader_lin_5.4_ts.so
    -rw-rw-r-- 1 507 507 1522528 Oct 26 08:42 ioncube_loader_lin_5.5.so
    -rw-rw-r-- 1 507 507 1604128 Oct 26 08:43 ioncube_loader_lin_5.5_ts.so
    -rw-rw-r-- 1 507 507 1488592 Oct 26 08:43 ioncube_loader_lin_5.6.so
    -rw-rw-r-- 1 507 507 1544720 Oct 26 08:44 ioncube_loader_lin_5.6_ts.so
    -rw-rw-r-- 1 507 507 1240944 Oct 26 08:44 ioncube_loader_lin_7.0.so
    -rw-rw-r-- 1 507 507 1293680 Oct 26 08:45 ioncube_loader_lin_7.0_ts.so
     
  6. Honza

    Honza Member HowtoForge Supporter

  7. till

    till Super Moderator Staff Member ISPConfig Developer

    This can be a problem with ioncude indeed. You should check if ioncube is really active in that website by placing a info.php file into the web dir of the site and if that's ok, then ask them if their encoded code is compatible with that ioncube version that you see in the info.php output. The ioncube tar.gz contains only the latest version (just for different php versions), when ioncube shows up in info.php, then you installed the right one.
     
  8. Honza

    Honza Member HowtoForge Supporter

    Thanks for the insight - I will reach out to them.
     
  9. Honza

    Honza Member HowtoForge Supporter

    I checked with guys at ioncube and they said the ioncube loader 6.0.6 version (latest as of today) is 100 % compatible with the WHMCS - refusing to give up the older versions.

    Any other ideas till?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    It's not easy to say why whmcs fails here as there is no specific error message and normal php scripts are working. All whmcs files in the web folder of the site belong to the web user and client group of this website?

    One other thing that you might try is to ask the guy's in this thread:

    https://www.howtoforge.com/community/threads/new-ispconfig-module-for-whmcs.67824/page-17

    They all use whmcs on ispconfig servers and might be able to give you some hints on it's installation.
     
  11. Honza

    Honza Member HowtoForge Supporter

    Thanks till - much appreciated - I didn't want to de-rail their talk but I guess I will have to ask as I'm running out of options :(
     
  12. webguyz

    webguyz Member HowtoForge Supporter

    I was getting 500 errors when I upgraded to Debian Jessie a while back. I tripled the fastcgi timeout of the vhost of my website. Please note I use PHP-FPM for all my websites including the one that has my WHMCS install
    I changed the default -idle-timeout 300 to 900 in the WHMCS website .vhost file in /etc/apache2/sites-available folder. See bolded below

    Code:
    <IfModule mod_fastcgi.c>
                    <Directory /var/www/clients/client1/web236/cgi-bin>
                                            Require all granted
                                        </Directory>
                    <Directory /var/www/www.webxxx.net/web>
                        <FilesMatch "\.php[345]?$">
                            SetHandler php5-fcgi
                        </FilesMatch>
                    </Directory>
                    <Directory /var/www/clients/client1/web236/web>
                        <FilesMatch "\.php[345]?$">
                            SetHandler php5-fcgi
                        </FilesMatch>
                    </Directory>
                    Action php5-fcgi /php5-fcgi virtual
                    Alias /php5-fcgi /var/www/clients/client1/web236/cgi-bin/php5-fcgi-72.2.177.56-80-www.xxx.net
                    FastCgiExternalServer /var/www/clients/client1/web236/cgi-bin/php5-fcgi-72.2.177.56-80-www.xxx.net -idle-timeout 300 -socket /var/lib/php5-fpm/web236.sock -pass-header Authorization
            </IfModule>
     
    Last edited: Dec 7, 2016 at 5:44 AM
  13. Honza

    Honza Member HowtoForge Supporter

    Thanks webguyz - I will take a look at it.
     
  14. Honza

    Honza Member HowtoForge Supporter

    I tried to update the "-idle-timeout 300" to 900 + restarted apache unfortunately still no luck - any other ideas?
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    The problem with the 500 error is that php simply "died" without issuing an error. So what you can try is if there is another way to get an error message. If you use apache server, then you can try to switch to mod_php and see if you get a different error then.

    another alternative approach can be to go to the web directory of the site on the shell and then run:

    php index.php

    (I assume here that whmcs has an index.php file) and post the messages that you get then, maybe it helps us to identify the problem. This assumes that you installed the ioncube loader in all php.ini files incl. the one of the commandline (cli) php.
     
  16. Honza

    Honza Member HowtoForge Supporter

    Yes I did install that: you installed the ioncube loader in all php.ini files incl. the one of the commandline (cli) php.

    ok after runing the php index.php from serversexample.com/web/admin I get:
    (same for php-fpm and mod_php)
    Which is sort of ridiculous - I'm using the default directory.

    If I try to run the php index.php from serversexample.com/web I get:
    - A lot of HTML code and not really an error -, however loading the site in Firefox gives me:
    (when using mod_php)
    (when using php-fpm)
    Is this script actually good and stable solution? I'm really concerned that if something happens to the site nobody will be able to debug it as it's all quite cryptic - never in my life had these problems while running scripts such as Wordpress or phpBB.
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    Hmm, ok. But we are getting a little step forward as we get at least error messages in the admin area now.

    Are you able to access the admin area in the browser? serversexample.com/web/admin

    If you get this admin directory error then I recommend that you contact whmcs with this error message and ask them what may cause it when you use the correct directory.
     
  18. till

    till Super Moderator Staff Member ISPConfig Developer

    Regarding the encoding error. maybe whmcs gzips the output automatically and you have automatic gzip encoding also enabled in e.g. apache so that the output is double encoded now? Just a guess.
     
  19. Honza

    Honza Member HowtoForge Supporter

    serversexample.com/web/admin - accessing this gives:
    (using php-fpm)
    (using mod_php)
     
  20. Honza

    Honza Member HowtoForge Supporter

    How do I disable it on the server side in case it's really double enabled?
     

Share This Page