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

After moving https://www.toneelmuseum.nl/ to a new server, there are now some issues:

  • the homepage of the manager is empty: Aanmelden | Toneelmuseum, but entering a different url is working, e.g.: Aanmelden | Toneelmuseum

  • links with [[~]], e.g. [[~103]], don’t work, this is the error from the log: [2024-05-08 11:34:20] (ERROR in resource 1 @ /var/www/clients/client51659/web153003/web/
    core/model/modx/modparser.class.php : 1367) Bad link tag [[~103]] encountered

  • the menu (wayfinder) is empty on the pages

Has it to do with the .htaccess?
Help is much appreciated.
Roel

If you open the developer tools in the browser, are there any errors in the console?
Maybe there is a widget on the dashboard that throws an error. Try (temporarily) removing the widgets (manager/?a=system/dashboards) to see if that helps (and to find out which one causes the issue).


Is there a resource with this ID?

Hello halftrainedharry, thanks a lot! The dashboard issue was solved after removing backupmodx and upgrademodx/ With a new download of these extras this is now oké. The [[~]] is not working with any id number, there is no issue with this page.

Maybe try deleting the cache folder (core/cache) manually and see if that helps.

Tried that already, but it didn’t help.

It’s this in the error log:
web/core/model/modx/modparser.class.php : 1367) Bad link tag [[~103]] encountered
web/core/model/modx/modparser.class.php : 1367) Bad link tag [[~202]] encountered
etc.

When I turn off friendly urls, the links work.

Does it work with friendly URLs and the system setting cache_alias_map = No?

YESSS! This does the job. You’re great, halftrainedharry.

So, it is a caching issue.

Normally MODX creates an alias map in the cache file core/cache/context_settings/web/context.cache.php (for the “web” context) to speed up the process of finding the URL corresponding to a resource-ID. Something must go wrong when creating this section of the cache file.

The file is there with permission rights 644.

With cache_alias_map = Yes there should be a section like this in the cache file:

'aliasMap' => 
  array (
    'somepage.html' => 2,
    'somefolder/anotherpage.html' => 3,
    ...
  ),

Does this exist? Is it a valid PHP array?

In context.cache.php aliasMap is not there.

Are the system settings friendly_urls and cache_alias_map set to Yes and did you clear the cache, so that the file gets regenerated?

Yes, it is in the file: <?php return array (
‘config’ =>
array (
),
‘aliasMap’ =>
array (
),

Thanks again!

The friendly url’s are now only working only with cache_alias_map = No. Is that oké?

It’s not optimal (especially on smaller sites). When the URLs aren’t cached, the code has to query the database for every request.


So are you saying that the ‘aliasMap’ exists in the cache file, but the array is empty?

Yes, this is a copy from that part of the php file.

Another error with caching, I see this in the error log:

web/core/cache/includes/elements/modsnippet/72.include.cache.php : 201) context for 248 is web (getResources doesn’t process with id248)

I als see this in the error log:
web/core/cache/includes/elements/modsnippet/72.include.cache.php : 430) SELECT modResource.id, modResource.type, modResource.contentType, modResource.pagetitle, modResource.longtitle, modResource.description, modResource.alias, modResource.alias_visible, modResource.link_attributes, modResource.published, modResource.pub_date, modResource.unpub_date, modResource.parent, modResource.isfolder, modResource.introtext, modResource.richtext, modResource.template, modResource.menuindex, modResource.searchable, modResource.cacheable, modResource.createdby, modResource.createdon, modResource.editedby, modResource.editedon, modResource.deleted, modResource.deletedon, modResource.deletedby, modResource.publishedon, modResource.publishedby, modResource.menutitle, modResource.donthit, modResource.privateweb, modResource.privatemgr, modResource.content_dispo, modResource.hidemenu, modResource.class_key, modResource.context_key, modResource.content_type, modResource.uri, modResource.uri_override, modResource.hide_children_in_tree, modResource.show_in_tree, modResource.properties FROM modx_site_content AS modResource WHERE ( ( modResource.parent IN (248) AND modResource.deleted = 0 AND modResource.published = 1 ) AND modResource.id NOT IN (89,249,311,312,313,314,315,316) ) ORDER BY publishedon DESC
(snippet 72 is getResources)

Do you use multiple contexts? Are there other contexts than “web”?