How to fix a Parse error: syntax error on your wordpress site

https://ichristaylor.com/2011/how-to-fix-a-parse-error-syntax-error-on-your

How to fix a “Parse error: syntax error” on your wordpress site hosted by 1and1I just broke my website šŸ™ and received the following error:

Parse error: syntax error, unexpected ‘=’, expecting ‘)’ in /homepages/43/dbxxxx/htdocs/xxxx/wp-content/themes/arras/library/admin/options.php on line 216

This error was caused after I upgraded a couple of plugins. A plugin error you say? Wrong! The answer was a straight forward .php error. Somewhere along the line I had rewritten my .htaccess file and removed support for PHP5 which is needed to run a modern wordpress install. (Needed? Maybe not but highly recommended)

If you get presented with one of these:

internal 500 server error

Or see the above Parse error in your wordpress dashboard or on any of your site’s pages DO NOT PANIC!

Here is what I did wrong:

1. I had just upgraded two plugins and wrongly assumed they were the problem.

2. I used my FTP programme to delete those plugins (by deleting their folders from the “/wp-content/plugins” directory.

3. I was surprised to see that my website was still down and I was still getting the 500 & the syntax error.

4. I assumed that the template had been corrupted. So I deleted that. The site was still down, and by now I was in a bit of a panic.

How I fixed this problem

1. Google. A quick (and I mean quick) search on google revealed that I was using an older version of PHP and I needed to force my host to use PHP 5.

2. Thanks to this site I added this code to my .htaccess file:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

3. I then uploaded that to my site’s root directory and hey presto my site was back.

4. I then uploaded my site’s theme, and reinstalled the plugins I had deleted and within an hour I was back to normal.

Lessons

I had previously added this code to my .htaccess file, but somewhere along the line I must have overwritten the file with a newer version that did not include the code. As I said above, your host really needs to be running the latest PHP (1and1 do, but you have to manually add the code to force it into action).

IĀ panicked and started deleting folders without backing them up. What I should have done was simply rename them. I have been lucky because I backup my site and was able to resolve the problem relatively quickly. In the worst case scenario I would have deleted everything and reinstalled wordpress and imported my wordress backup file.

If you don’t have a strategy to get your website back online quickly, you really need to devise one now.

You might also like

Copywriting Tips

Copywriting Tips

Copywriting is the art of writing persuasively with the intent of driving an action. Therefore your writing should focus on your desired outcome. Follow these

Read More Ā»