HTTP ERROR 500 - caused by typographical issue in wp-config.php

Hi,

I got an error HTTP ERROR 500 for a couple of days. I was able to troubleshoot and fix the error, but I would like to know what caused it. Note that I didn’t make changes to my site or the file before the error occured.

Error was caused by a typographical issue in my wp-config.php file
incorrect line: define ( ‘WP_MEMORY_LIMIT’, ‘1536M’ );
correct line: define(‘WP_MEMORY_LIMIT’, ‘1536M’);
Changing the incorrect line to correct line fixed the issue.

Hope this can help others, and I can get an understading what changed the wp-config.php file for me.

And because you didn’t use code formatting, both of the lines you wrote are syntactically the same, and equally incorrect.

The correct syntax is define('WP_MEMORY_LIMIT', '1536M');. With straight, single quotes. Not the curved and upside down quotes in your post.

When dealing with code, always make sure to put it in something that’s suitable for code. That can be a code formatting block, which this forum offers for example. But also make sure to never put it in a document editor like Word, because such systems will try to make your code “more aesthetically pleasing”, which it will be, but make it invalid as code.

I don’t know how this code came to be in your configuration. I know we didn’t put it there, and I can’t imagine WordPress putting it there either. If I had to guess, I would say that you tried to increase the memory limit, and copied this line from somewhere. But either the source had the syntax error, or something went wrong during the copying process.

Also, our hosting has a memory limit of 128 MB. Setting the limit in WP higher will not work because the server limit is hard coded to a lower value.

8 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.