Can't connect to db after migrating host

I’m moving a MODX 2.8.5. site to a different host and for some reason I can’t connect to the db while trying to run the setup.

  • I moved all files and the db.
  • I removed everything within core/cache
  • I adjusted the paths in all config.core.php files (root, manager, connectors) and also everything within core/config as well.

When I do the Advanced Upgrade and I click to check the db connection, nothing happens. The dev console response shows me:

<br />
<b>Fatal error</b>:  Uncaught Error: Call to a member function parseProperties() on null in .../cms/core/model/modx/modelement.class.php:567
Stack trace:
#0 .../core/model/modx/modx.class.php(1672): modElement-&gt;getProperties()
#1 .../core/model/modx/modx.class.php(566): modX-&gt;invokeEvent()
#2 .../setup/includes/modinstall.class.php(492): modX-&gt;initialize()
#3 .../setup/includes/modinstall.class.php(175): modInstall-&gt;_modx()
#4 .../setup/processors/database/connection.php(35): modInstall-&gt;getConnection()
#5 .../setup/includes/request/modinstallconnectorrequest.class.php(85): include('/var/www/vhosts...')
#6 .../setup/processors/connector.php(40): modInstallConnectorRequest-&gt;handle()
#7 {main}
  thrown in <b>.../core/model/modx/modelement.class.php</b> on line <b>567</b><br />

I found an old post with similar errors and the solution seems to be to reinstall pdoTools. How would I do that though, if I can’t access the site?

Or is this caused by something else?

Try running setup again. Usually fixes anything messed up from relocation.

1 Like

You mentioned the config.core.php files but not core/config/ You may need to adjust some things there. Setup usually straightens our the paths and URLs, but not always.

There is also a config.core.php file in the setup/includes directory. You might try hard-coding the actual path to the core directory there and running setup again.

Trying setup with your browser in Incognito or Private mode will eliminate any issues with cookies and the browser cache.

That’s what I’m trying to do. With Advanced Upgrade I meant this option within the setup.

I adjusted all the paths and db settings in the With no luck…

No luck either…

Good idea, but this didn’t work either.

I have no idea, what’s going on here. Checking the Moving Your Site doc again and it looks like I forgot to disable FURL. Any way I can do this without access to the manager? I did rename all htaccess files, so they are not interfering.

Also trying to access the root of the site or the /manager results in a 500.

When I try to do the regular Setup it gives me quite similar errors (directly displayed on the page):

**Fatal error** : Uncaught Error: Call to a member function parseProperties() on null in 
/core/model/modx/modelement.class.php:567 Stack trace: 
#0 /core/model/modx/modx.class.php(1672): modElement->getProperties() 
#1 /core/model/modx/modx.class.php(566): modX->invokeEvent() 
#2 /setup/includes/modinstall.class.php(492): modX->initialize() 
#3 /setup/includes/modinstall.class.php(150): modInstall->_modx() 
#4 /setup/includes/test/modinstalltest.class.php(315): modInstall->getConnection() 
#5 /setup/includes/test/modinstalltest.class.php(51): modInstallTest->_checkDatabase() 
#6 /setup/includes/modinstall.class.php(229): modInstallTest->run() 
#7 /setup/controllers/summary.php(29): modInstall->test() 
#8 /setup/includes/request/modinstallrequest.class.php(80): include('/var/www/vhosts...') 
#9 /setup/index.php(106): modInstallRequest->handle() 
#10 {main} thrown in **/core/model/modx/modelement.class.php** on line **567**

Any ideas are highly appreciated.

It’s really easy to make a mistake in, like confusing paths and URLs. I’ve done it many times. Each time I was sure it was correct.

The first error is odd. It suggests that MODX is not being instantiated (i.e., $modx === null), but there are other calls to MODX in the stack trace.

Did you, by any chance, move the files individually to the new server with FTP? That often results in missing or corrupted files.

I was hoping that I made a mistake in there somewhere, too. But now I even made a fresh (and working) test install on the new host to compare the config files to make sure the root path is correct. I checked every path many times and I can’t find a mistake.

Files moved zipped up. I might try to do it all over again, just in case…

It seems, that it’s working now! I ditched everything and started from scratch. Also I made the whole file package as small as possible by moving images and documents (which I have a lot of) separately.

Additionally I compared the PHP settings from my provider and noticed that the open_basedir setting was different, so adjusted the new hosts default to the old hosts setting:

// old host

// new host default
{DOCROOT}{/}{:}{TMP}{/}{:}{/}var{/}lib{/}php{/}sessions{:}{WEBSPACEROOT}{/}tmp (Standard)

Thank you for your help! In situations like these it’s really helpful to have someone else suggest some ideas!

I’m glad you got it sorted. It’s the kind of problem that can drive you nuts.

1 Like