XF 2.1 SOLVED: White pages after upgrading from PHP 7.1.30 to 7.2.x or 7.3.x

djbaxter

in memoriam 1947-2022
As the title says, when I upgrade from PHP 7.1.30 to either 7.2.x or 7.3.x using WHM/cPanel, I just get blank white pages on both the forum page and the admin page.

When I revert back to 7.1.30, everything works again.

What would cause this?
 
I found the following lines in .htaccess added by cPanel at some point:

Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Once I deleted those lines, the forum runs fine on 7.2.x.

I then upgraded to 7.3.7 and everything is fine running that version as well.
 
Hmmm... I tried upgrading PHP on another forum, same host, different dedicated server.

This time, removing those lines in .htaccess did not fix the problem.

1. Are there any other causes for blank pages in XF2.1?

2. How do I enable error reporting in config.php?
Code:
// enable error reporting
ini_set('display_errors', true);
 
Last edited:
On the second forum, after enabling errors, I am getting this:

Code:
Fatal error: Uncaught Error: Call to undefined function mysqli_init() in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php:152 Stack trace: #0 /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array) #1 /home/{domain}/public_html/src/XF/Error.php(85): XF\Db\Mysqli\Adapter->getConnection() #2 /home/{domain}/public_html/src/XF/App.php(2189): XF\Error->logException(Object(Error), true, '') #3 /home/{domain}/public_html/src/XF.php(170): XF\App->logException(Object(Error), true) #4 [internal function]: XF::handleException(Object(Error)) #5 {main} thrown in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php on line 152

Fatal error: Uncaught Error: Call to undefined function mysqli_init() in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php:152 Stack trace: #0 /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array) #1 /home/{domain}/public_html/src/XF/Error.php(85): XF\Db\Mysqli\Adapter->getConnection() #2 /home/{domain}/public_html/src/XF/App.php(2189): XF\Error->logException(Object(ErrorException), true, '') #3 /home/{domain}/public_html/src/XF.php(210): XF\App->logException(Object(ErrorException), true) #4 [internal function]: XF::handleFatalError() #5 {main} thrown in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php on line 152
 
Normally cpanel changes those lines to the correct php version.

Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
 
On the second forum, after enabling errors, I am getting this:

Code:
Fatal error: Uncaught Error: Call to undefined function mysqli_init() in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php:152 Stack trace: #0 /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array) #1 /home/{domain}/public_html/src/XF/Error.php(85): XF\Db\Mysqli\Adapter->getConnection() #2 /home/{domain}/public_html/src/XF/App.php(2189): XF\Error->logException(Object(Error), true, '') #3 /home/{domain}/public_html/src/XF.php(170): XF\App->logException(Object(Error), true) #4 [internal function]: XF::handleException(Object(Error)) #5 {main} thrown in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php on line 152

Fatal error: Uncaught Error: Call to undefined function mysqli_init() in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php:152 Stack trace: #0 /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array) #1 /home/{domain}/public_html/src/XF/Error.php(85): XF\Db\Mysqli\Adapter->getConnection() #2 /home/{domain}/public_html/src/XF/App.php(2189): XF\Error->logException(Object(ErrorException), true, '') #3 /home/{domain}/public_html/src/XF.php(210): XF\App->logException(Object(ErrorException), true) #4 [internal function]: XF::handleFatalError() #5 {main} thrown in /home/{domain}/public_html/src/XF/Db/Mysqli/Adapter.php on line 152

Your server is missing mysqli. Go to WHM > EasyApache > PHP Extensions > Install these (attached).

Screenshot at Aug 03 15-30-16.webp
 
Normally cpanel changes those lines to the correct php version.

Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
Yes it does if you set the version as default for the server.

But I still get white pages and the fatal error reported above for either PHP 7.2 or 7.3 whether I leave those lines in htaccess or remove them.

No errors at all on PHP 7.1
 
Your server is missing mysqli. Go to WHM > EasyApache > PHP Extensions > Install these (attached).

View attachment 207708
Thank you.

Looks like that was part of it. Enabled php72-php-mysqlnd and php72-php-mysqlnd.

Now with either 7.2 or 7.3 I get a different error:

Code:
Fatal error: Method XF\Widget\WidgetRenderer::__toString() must not throw an exception, caught Error: Call to undefined function XF\Mvc\iconv() in /home/{domain}/public_html/src/XF/Template/Templater.php on line 0
 
That was a while ago and to be honest I can't recall. I think mbstring was one. Check against the Xenforo list in the AdminCP.

But on that server, here's the PHP73 configuaration.

Code:
All PHP73 modules active on the server (not all necessarily needed for Xenforo):

php73-pear
php73-php-bcmath
php73-php-calendar
php73-php-cli
php73-php-common
php73-php-curl
php73-php-dba
php73-php-devel
php73-php-exif
php73-php-fileinfo
php73-php-ftp
php73-php-gd
php73-php-gettext
php73-php-gmp
php73-php-iconv
php73-php-intl
php73-php-litespeed
php73-php-mbstring
php73-php-mysqlnd
php73-php-pdo
php73-php-pgsql
php73-php-posix
php73-php-process
php73-php-pspell
php73-php-soap
php73-php-xml
php73-php-xmlrpc
php73-php-zip
php73-runtime
php73-scldevel

PHP73 settings on that server:

allow_url_fopen     Enabled
allow_url_include  Enabled
file_uploads  Enabled

Here's what the AdminCP for that forum says:

Code:
PHP version     7.3.12
MySQL version     5.7.28
PHP post_max_size     128M
PHP upload_max_filesize     64M
PHP max_input_vars     1000
PHP max_execution_time     90
cURL version     7.67.0
SSL version     OpenSSL/1.0.2t
Suhosin enabled     No
Imagick support     Yes
EXIF support     Yes
GZip support     Yes
mbstring support     Yes
gmp support     Yes
ZipArchive support     Yes
 
Thank you!
php73-php-iconv was the one that caused that specific error message. After that the forum came up again ;-)
Later I discovered that the push notifications was causing errors and that was resolved by adding php73-php-gmp
 
Top Bottom