Fata Error php 7

I’ve got a site where the hosting is still running php 5.4. They’re about to upgrade to 7.4. So in anticipation, I upgrade Modx to 2.8.1 and manually set the php on the server to 7.0.

I tried several versions 7.0 or higher. All crashed the site, when I revert back to older version the site came right back. I manually deleted the Modx cache before reloading the site once the php version was changed.

I don’t know how to proceed. Any ideas?

The site crashes with this error:

Fatal error: Uncaught Error: Class ‘PDO’ not found in /home4/xxxxxxx/public_html/core/xpdo/xpdo.class.php:3117 Stack trace: #0 /home4/xxxxxxx/public_html/core/xpdo/xpdo.class.php(454): xPDOConnection->connect(Array)
#1 /home4/xxxxxxx/public_html/core/xpdo/xpdo.class.php(2526): xPDO->connect()
#2 /home4/xxxxxxx/public_html/core/xpdo/om/xpdoquery.class.php(649): xPDO->prepare(‘SELECT `modSyst…’)
#3 /home4/xxxxxxx/public_html/core/xpdo/om/xpdoobject.class.php(233): xPDOQuery->prepare()
#4 /home4/xxxxxxx/public_html/core/xpdo/om/xpdoobject.class.php(485): xPDOObject::_loadRows(Object(modX), ‘modSystemSettin…’, Object(xPDOQuery_mysql))
#5 /home4/xxxxxxx/public_html/core/xpdo/xpdo.class.php(757): xPDOObject::loadCollection(Object(modX), ‘modSystemSettin…’, Object(xPDOQuery_mysql), true)
#6 /home4/xxxxxxx/public_html/core/xpdo/xpdo.class.php(863): xPDO->call(‘modSystemSettin…’, ‘loadCollection’, Array)
#7 /home4/xxxxxxx/public_html/core/model/modx/modcachemanager.class.php(234): xPDO->getCollection(‘modSystemSettin…’) in /home4/xxxxxxx/public_html/core/xpdo/xpdo.class.php on line 3117

sounds like PDO is not enabled with that php-versions on that server

Thanks Bruno.

Is this normal for shared hosting? I’ve not encountered this before. I’ll have to contact them to see if they can fix that.

Just finished a long chat with hosting support. We did discover conflicting entries in the .htaccess, which we removed. However, any version of php 7.0 or higher is still not working.

I found this in the Modx system info report:

PDO support: enabled
PDO drivers: mysql, sqlite
PDO Driver for MySQL: enabled
Client API version: 5.6.41-84.1
Directive: Local Value,Master Value

I’m not sure if this applies to you as you have a different error message, but I had a similiar issue after updating the PHP version on a shared hosting:

(Just in case you haven’t seen this before.)

Thanks videbdesign, but I’m not sure this how this might apply to me.

Are the errors you’re seeing still the same after that, i.e. Class 'PDO' not found?

Yes, exactly the same.

I wonder if this could be an autoloader issue, since PDO is enabled, and tech. support probably checked to make sure the pdo.php file is in the right place.

Maybe the autoloader is confused about where to look for it.

Thanks Ray. I have no idea what this means. LOL. How do I check for this? Since this is shared hosting, wouldn’t other sites on the same server have problems too?

Is there a php.ini file in the MODX web root? If so, you may need to explicitly load the relevant modules in said file like so: