HTTP ERROR 500 when accessing Modx Manager after applying FormIT Anti-Spam tutorial

Hello dear Modx community,

Unfortunately, I am unable to access the Modx Manager on a website and am receiving an “HTTP ERROR 500” message. This issue started after following the instructions found at “bitego | Protect a FormIt web form from spam without using a Captcha?”.

I have tried restoring a backup, but the issue still persists. Strangely enough, the website itself is functioning without any problems.

Is there more content in this error message? This could help to identify the cause of the error.
Maybe also check the server error log, to see if something (related) gets logged there.

The content of this article shouldn’t affect the MODX manager at all.

Hey @halftrainedharry
Unfortunately, no additional error code is displayed.
After adding the ‘ContactFormMailTpl’ chunk, the manager stopped working.

A 500 error could be anything. Without a proper error message (or a stack trace) it’s almost impossible to determine what causes the error.

Unfortunately this doesn’t make much sense. This chunk doesn’t get loaded or executed in the manager. You could try manually deleting the chunk again from the database table modx_site_htmlsnippets, but I doubt this changes anything.

I can’t imagine what else could be causing this. I only followed the instructions provided in the manual for the last step.

I’m suspecting it might be a hacking attack :confused: The Sitedash monitoring is showing a high CPU usage at the moment

I just spoke with my web host and they don’t see any signs of an attack. Now, I’m wondering how to fix the issue with the manager :frowning: The HTTP ERROR 500 message with the header ‘Unable to process this request at the moment’ is still being displayed.

Do they have access to a server error log where the error might be logged?

Does the error affect all manager page or only the “Welcome Page”?
Can you for example access or manager/?a=workspaces?

I have already tested that, unfortunately, I do not have access to the /manager path in general… I also cannot read error logs, as Sitedash shows me the following:

I have found a log file from this morning… I am not sure if it is the right one…

[2023-03-21 11:07:17] (INFO @ /homepages/42/d166110/htdocs/modx/core/components/sitedashclient/src/Upgrade/Execute.php : 38) Initialising remote SiteDash upgrade
[2023-03-21 11:07:17] (INFO @ /homepages/42/d16110/htdocs/modx/core/components/sitedashclient/src/Upgrade/Execute.php : 516) Using automatically detected `/usr/bin/php`
[2023-03-21 11:07:17] (INFO @ /homepages/42/d16310/htdocs/modx/core/components/sitedashclient/src/Upgrade/Execute.php : 516) Testing PHP executable: `/usr/bin/php --version`
[2023-03-21 11:07:18] (INFO @ /homepages/42/d16/htdocs/modx/core/components/sitedashclient/src/Upgrade/Execute.php : 516) PHP Version check: Status: 401 Unauthorized
Set-Cookie: PHPSESSID=ab5eaaf281aa178121c17c894f88c824; expires=Tue, 28 Mar 2023 10:07:18 GMT; Max-Age=604800; path=/; secure; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-type: text/html; charset=UTF-8

{"success":false,"message":"Invalid authentication."}
[2023-03-21 11:07:18] (ERROR @ /homepages/42/d110/htdocs/modx/core/components/sitedashclient/src/Upgrade/Execute.php : 159) PHP version check did not return the PHP version, suggests an invalid binary.

Do you have FTP access to the web root? The MODX error log file is in the folder core/cache/logs.

Also, if it is (for example) a PHP error, then it should get logged somewhere (outside of MODX) in a server error log. (The exact location depends on the server configuration.)

I have access to the /Logs directory.
In the folder /core/cache/logs there is only one file, and that is the one I just sent you…

All the content of this “error.log” file is from the SiteDash extra and unrelated to the manager access issue.

I have checked some things again now, and I cannot find a direct answer to the error in the logs. Has it not happened before that the manager was not accessible? I find it very strange that it suddenly stopped working.

Sure that happens. But there can be a lot of reasons why an error occurs. Usually an extra was installed that is not compatible, or a custom plugin was created that contains a syntax error. Maybe the PHP version of the server was changed and the installed MODX version doesn’t support it.

But the creation of a chunk with some text and some placeholders won’t crash the manager.

You could try different things: For example deleting the whole cache directory (core/cache) or deactivating the plugins (database table modx_site_plugins → column disabled) and see if that helps. But without a proper error message (from the server error log) it’s just guesswork.

Hey Harry, thank you so much for all your help, but I’m not making any progress at all. :slight_smile:
I have now disabled all plugins, but it doesn’t seem to have any effect as all the plugins are still being loaded on the website.
The website itself is working perfectly fine.
I have taken a closer look at the logs, but I’m not sure what to look for. The specific errors that were mentioned are not being displayed.

None of the things you’re describing sound like they have anything to do with the FormIt changes you made. I believe, and I assume @halftrainedharry feels the same, that the 500 is coincidental but independant to the FormIt changes.

Some questions to clarify:

  • Are you able to access the login screen of the manager or does that 500?
  • What version of MODX are you running?
  • What version of PHP is the server running? This should be visible in your cPanel or by creating a php_info() call in a php file and visiting the URL.

If it were me debugging this kind of issue, I’d personally check to make sure that the file locations have not changed. It’s very easy to accidentally drag and drop directories in the Files tree inside MODX into the wrong place. This can definitely cause 500s (though you’d also get an error that the config file can’t be located). Other things to review include permsissions on files and folders, though normally, those don’t just throw 500 errors.

If you did disable all the plugins, they will not be disabled until you empty the site’s cache directory in core/cache/*.

It may be worthwhile paying someone to look at this depending on how much time you want to burn here vs someone just going in and looking and potentially seeing what you’re not.

As Jay says, after disabling the plugins, you need to manually empty the core/cache/ directory using cPanel’s File Manager. Otherwise, they will keep executing.

I think there’s a good chance that this will let you into the Manager. If it does, you can add the plugins back one at a time (clearing the cache each time) to see which one is causing trouble.

I’m suspecting it might be a hacking attack :confused: The Sitedash monitoring is showing a high CPU usage at the moment

If it is a hack then you might want to look at these posts:

Hello @Rykoutech, as the others have mentioned, we do need more information on the cause to find a solution. Also I wanted to mention that, even though you “only” created a new chunk: by saving you cleared the cache, and that’s why it could be from something else which wasn’t cached yet.

I’m personally guessing it is a php-error, so to find out why that 500 blank page error is happening, I would go on like this:

  • Set MODX to debug-mode (as you can’t access the manager, go into PHPMyAdmin, open the modx_system_settings-table and look for the setting debug: then set it to 1)
  • Via FTP or SSH delete the folder /core/cache/ recursively
  • Find out the real path to your modx-setup - and copy it somewhere temporarily:
    • if you have access via SSH, cd into your directory and type in pwd
    • if you only have access via FTP, go into your web-root and create a new file info.php with this content: <?php phpinfo();, then in your browser, navigate to this new file and look for document_root
  • Via FTP or SSH go into the folder /manager/ and edit the index.php, at the very top (after <?php) paste in this:
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("log_errors", 1);
ini_set("error_log", "/YOUR/PATH/TO/YOUR/MODX/php-error.log"); // change path accordingly

Now, you should start seeing some real error(s).
First try opening any manager-page in the browser.
If you don’t see errors in the browser, check the error-log you just set up.
We are mostly interested in the fatal errors, not warnings.

Please report back and let us know what you find out :slight_smile:

1 Like