Issues after moving to new server (modx 2.8.5 PHP 8.2.17)

Just manager and web, never worked with contexts.

It’s weird that the ‘aliasMap’ array is empty. It must have worked on the old server. I have no idea why it wouldn’t work now.

When you run this SQL query (for example with phpMyAdmin), do you get a result?

SELECT `r`.`id`, `r`.`parent`, `r`.`uri` FROM `modx_site_content` `r` FORCE INDEX (`cache_refresh_idx`) LEFT JOIN `modx_context_resource` `cr` ON `cr`.`context_key` = 'web' AND `r`.`id` = `cr`.`resource` WHERE `r`.`deleted` = 0 AND (`r`.`context_key` = 'web' OR `cr`.`context_key` IS NOT NULL) GROUP BY `r`.`parent`, `r`.`menuindex`, `r`.`id`, `r`.`uri`

These getResources log messages aren’t errors. They just appear in the log because you use the &debug=`1` property.

In phpmyadmin I get the error:
#1176 - Key 'cache_refresh_idx' doesn't exist in table 'r'

Maybe when you moved the database to the new server, the indexes haven’t been moved as well.

In phpMyAdmin → table modx_site_content → tab “Structure”, when you scroll down to the section “Indexes”, are there any indexes listed?

Scrolling down I see:
Data 16 Kib
Index 0 B
Total 16 KiB

How did you transfer the database data? With a .sql file you exported with phpMyAdmin?

In the .sql file, the CREATE TABLE command for modx_site_content (and all the other tables) should include the indexes (for example KEY `cache_refresh_idx` (`parent`,`menuindex`,`id`)):

DROP TABLE IF EXISTS `modx_site_content`;
CREATE TABLE IF NOT EXISTS `modx_site_content` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` varchar(20) NOT NULL DEFAULT 'document',
  ...
  PRIMARY KEY (`id`),
  KEY `alias` (`alias`),
  ...
  KEY `cache_refresh_idx` (`parent`,`menuindex`,`id`)
) 

The sql file from a backup. I see in the old table:
Index 304 KiB; should I export/import this to the new table?

Do the indexes exist in any of your database table?

So I guess the indexes are all missing?!
Does the SQL command SHOW INDEXES FROM `modx_site_content`; return anything?

If there are no indexes, you probably have to import the data again or transfer it differently, so that MySQL knows what indexes to create.

No table site_content_indexes.

Returns empty; on the old server it is not empty, I will transfer these to the new database. I will try it tomorrow.
Halftrainedharry, thankyou so far.

Goodmorning halftrainedharry, I’ve made the new export/import of the table modx_site_content, and everything is working smoothly. With cache_alias_map now set to ‘yes’ I see a large array under ‘aliasMap’ on the file ‘context.cache.php’.
You’ve made my day, thanks!

1 Like