Today I updated the OS including php. Ispconfig gave a 500 error, though it worked before the update. I tried updating ispconfig from the command line, and then got this error in apache error log: mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, bool given in /usr/local/ispconfig/interface/lib/classes/tpl.inc.php(1366) Ispconfig worked before the OS update. OS is ubuntu 18, php-cgi is 7.2. The code in line 1366 is below: $success = @eval($this->_tmplfilep); How can this be fixed? Thanks for any suggestions.
Thanks! That pointed me in the right direction. Still ispconfig is not loading, but I found that .php-fcgi-starter cannot be edited, but specifies /usr/bin/php-cgi which points to ... /usr/bin/php-cgi -> /etc/alternatives/php-cgi* which points to /usr/bin/php-cgi8.0* I know ispconfig won't work yet with php 8 - so I changed it as below: # update-alternatives --config php-cgi There are 5 choices for the alternative php-cgi (providing /usr/bin/php-cgi). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/php-cgi8.0 80 auto mode 1 /usr/bin/php-cgi7.1 71 manual mode 2 /usr/bin/php-cgi7.2 72 manual mode 3 /usr/bin/php-cgi7.3 73 manual mode 4 /usr/bin/php-cgi7.4 74 manual mode 5 /usr/bin/php-cgi8.0 80 manual mode Press <enter> to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/bin/php-cgi7.2 to provide /usr/bin/php-cgi (php-cgi) in manual mode I get the login prompt/page, and when I login all I see is the top logo and the Logout button. The rest of the page is empty. This was in a private window.
This is what's in /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter Code: # cat .php-fcgi-starter #!/bin/sh PHPRC=/etc/php/7.2/cgi/ export PHPRC export PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_CHILDREN=1 exec /usr/bin/php-cgi \ -d disable_classes= \ -d disable_functions= \ -d magic_quotes_gpc=off \ -d open_basedir= \ -d session.save_path=/usr/local/ispconfig/interface/temp So it seems the cgi is used instead of cli. Or does the cli get used later, after this starter script? Thanks
I see you asked for the cli version and I gave the cgi - here is just plain php: /usr/bin/php -> /etc/alternatives/php* /etc/alternatives/php -> /usr/bin/php7.2*
Simply run php -v in your terminal and post its result in here. If php cli default is no longer php7.2, then restore it. Read this tip on how to monitor your default php and restore automatically if it is changed: https://www.howtoforge.com/community/threads/monitor-os-default-php-and-restore-if-changed.83288/
Thanks, here it is: # php -v PHP 7.2.34-18+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2021 15:08:03) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.34-18+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
Now ispconfig lets me login but then the only thing displayed is the header - logout button, logo and search box. This is strange, it worked before updating php. The same error appears while tailing apache error logs, Code: mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, bool given in /usr/local/ispconfig/interface/lib/classes/tpl.inc.php(1366)
Thanks; I can update, not sure how to force the update? Is that more than just running the update script? Also I updated ispconfig a few hours ago, after this problem appeared. Are you suggesting to reinstall ispconfig? Thanks
No, you would lose the whole server config in this case. Run: ispconfig_update.sh --force to do a forces update. If this does not help, then there are probably still problems with the PHP installation of the server.
I see now how to force update - am going to try that... Code: Select update method (stable,nightly,git-develop) [stable]: There are no updates available for ISPConfig 3.2.2 If you are sure you want to update to stable anyway, please use --force parameter DOWNGRADING MAY CAUSE ISSUES! I am forcing update now....
In case this may be helpful for others, this is what I found: It seems that setting the php version back from 8 to 7 (I used 7.2) needs to be done BEFORE running ispconfig_update.sh. When I did this set php back on another server, there was no need to force the update. But, on yet another server, when I ran the ispconfig update before setting php back from 8 to 7, I had to run the ispconfig update again. I used update-alternatives --config php-cgi and update-alternatives --config php to set php back from 8 to 7 (7.2 in my case, since that was the version I saw in /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter)
This is covered in the read before posting: https://www.howtoforge.com/community/threads/please-read-before-posting.58408/
Thank you Thom, I see that now. I just found out that roundcube is giving http 500 error now. I ran the test script on the read before posting: https://www.howtoforge.com/community/threads/please-read-before-posting.58408/ and am attaching the report file. Roundcube worked a day or 2 earlier, before updating the OS. OS is Ubuntu 18.04, and php is 7.2: Code: # lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic # php -v PHP 7.2.34-18+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2021 15:08:03) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.34-18+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies Below is a log, from tailing apache error logs, when I reloaded the webmail URL (I replaced an address with x's and formatted it a bit for readability - it was all on one line): Code: # tail -f /var/log/apache2/error.log [Mon Mar 08 21:01:56.071243 2021] [proxy_fcgi:error] [pid 4010] [client xx.xx.xx.xx:50716] AH01071: Got error 'PHP message: PHP Warning: Undefined array key "env" in /usr/share/roundcube/index.php on line 43 PHP message: PHP Warning: Undefined variable $rcmail_config in /usr/share/roundcube/program/lib/Roundcube/rcube_config.php on line 325 PHP message: PHP Warning: Undefined variable $rcmail_config in /usr/share/roundcube/program/lib/Roundcube/rcube_config.php on line 325 PHP message: PHP Warning: Undefined array key 2 in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 223 PHP message: PHP Warning: Undefined array key "UTF-8" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 340 PHP message: PHP Warning: Undefined array key "UTF7-IMAP" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 341 PHP message: PHP Warning: Undefined array key "UTF-8" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 340 PHP message: PHP Warning: Undefined array key "UTF7-IMAP" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 341 PHP message: PHP Warning: Undefined array key "UTF-8" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 340 PHP message: PHP Warning: Undefined array key "UTF7-IMAP" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 341 PHP message: PHP Warning: Undefined array key "UTF-8" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 340 PHP message: PHP Warning: Undefined array key "UTF7-IMAP" in /usr/share/roundcube/program/lib/Roundcube/rcube_charset.php on line 341' How can this be fixed? Thanks for any suggestions.
I modified /usr/share/roundcube/index.php to output php version (phpinfo() and found roundcube is using php 8. Am looking now to find where to change the php version used by roundcube.
That is one way of fixing it but if you use Onrej Sury repo for php, you may notice that it will install it back in future php update. That is why restoring default php is my preferred way and in my earlier post I shared a link to another thread where I tipped on how to use monit in monitoring default php and monit will restore it whenever it detected any changes.
It would be better to change the default PHP handler instead of uninstalling it, but if you don't need PHP 8, it's a way to go.