I changed a few files with the header and footer and then this error
appearing…
Bad character encoding is a very typical cause of 500 server errors.
What text editor did you use to edit the files? Are you using the correct text encoding in the files, i.e. Unicode for a linux server?
If the text encoding is OK and you’re still getting the out of memory error, and that line define('WP_MEMORY_LIMIT', '64M');
doesn’t help, ask your webhost; they will need to increase memory for you.