Changing PHP version causes unexpected database error

AndyX

Well-Known Member
Sep 25, 2015
87
11
58
Los Altos, CA
cPanel Access Level
Root Administrator
Currently the PHP version on the shared server I'm working on at GoDaddy is 5.4 (native), but it doesn't support Imagick. If I select PHP 5.4 or PHP 5.5 it includes Imagick so I would like to switch to it. The problem is when I select another PHP version, the XenForo forum dies, the error message is:

An unexpected database error occurred. Please try again later.
The tech support at GoDaddy was unable to provide a reason why the database stops working for XenForo yet works for the WordPress database.
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
That is a generic error message, you need to find the actual one, my guess is the new version of PHP probably doesn't have mysqli built or enabled. Is GoDaddy using CL now? If so, when you select the PHP version you should be able to select different PHP mods as well like mysqli, pdo, etc. If you can link a PHP info script I may be able to help, if you also have SSH access I would search for any error_log as the actual error message is most likely in one of those.

In your public_html do:

# find . -type f -name error_log -exec tail -5 {} \;

That will find all error logs and output the last 5 lines in each which should hopefully help and narrow it down.
 

AndyX

Well-Known Member
Sep 25, 2015
87
11
58
Los Altos, CA
cPanel Access Level
Root Administrator
Hello,

Thank you for your help. When I select PHP 5.5 I get the following defaults:

pic001.jpg

Looking at other web sites I manage I compared and it looks like everything is enabled properly. Again the issue is XenForo forum software is not able to be run because of the unexpected database error.

I don't have SSH access as this is a shared server.
 
Last edited by a moderator:

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
Yeah the unexpected database error is most likely because it cannot connect to the database. If you enable PHP 5.5 again, refresh the site, then right click it and goto view source. Is there anything output there in source code that gives anymore info other than 'unexpected database error' which again is a generic response not an actual error.
 

AndyX

Well-Known Member
Sep 25, 2015
87
11
58
Los Altos, CA
cPanel Access Level
Root Administrator
goto view source. Is there anything output there in source code that gives anymore info other than 'unexpected database error' which again is a generic response not an actual error.
Excellent suggestion. This is what source shows:

An unexpected database error occurred. Please try again later.
<!-- The Mysqli extension is required for this adapter but the extension is not loaded -->
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
Hmm so it should be working then as I see you clearly selected it in PHP selector.

Can you link me to a php info script while PHP 5.5 is loaded.
 

AndyX

Well-Known Member
Sep 25, 2015
87
11
58
Los Altos, CA
cPanel Access Level
Root Administrator
Hi jcats,

With your help I finally got this working, thank you.

In order to make Imagick PECL extension work on GoDaddy I had to do the following:

1) In cPanel switch from PHP 5.4 native to PHP 5.5.
2) Delete public_html/php.ini as that prevented MySQLI from loading.
 
  • Like
Reactions: Infopro

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
Hmm that is strange as I didn't even think php.ini was recognized when using the php selector. I am glad to hear you got it resolved though
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Hello :)

I am happy to see the issue is now resolved. Thank you for updating us with the outcome.