PHP Errors
PHP Parse Error
Last reviewed
Direct answer
A PHP parse error means the engine rejected a file’s syntax before running it—open the log for the file and line, restore a clean copy of that plugin/theme/snippet (or fix the missing bracket/tag), and roll back a PHP version change if new syntax rules broke old code.
Parse errors are syntax failures: missing semicolons, unmatched braces, bad short tags, or code written for a different PHP version. On WordPress they often appear right after editing functions.php, pasting a snippet, or switching PHP. This WordPress Repair guide focuses on finding the broken file fast, restoring service, and preventing another bad paste from taking the site down.
Key facts
Verifiable numbers and definitions — each claim links to its source.
- PHP documents E_PARSE as a compile-time parse error, separate from run-time E_ERROR fatals. (PHP.net — Error level constants)
- PHP’s errors overview explains that some failures occur when code cannot be parsed into valid syntax before execution. (PHP.net — Errors)
- WordPress debugging docs describe logging PHP errors to debug.log so parse and fatal failures can be traced to a file path. (WordPress — Debugging)
What the error means
PHP parses each requested file into tokens before executing it. If the syntax is invalid, the engine raises a parse error (E_PARSE) and stops—nothing in that file runs. That is different from a run-time fatal such as calling an undefined function after the file parsed cleanly. WordPress never “soft fails” a parse error in an active plugin or theme file involved in bootstrap: you get a critical-error screen, white screen, or HTTP 500 depending on display_errors and WordPress recovery. Common authors of parse errors include a mistyped functions.php edit, a truncated plugin file from a failed upload, a snippet plugin with a stray shortcode pasted into PHP, or PHP version mismatches (for example older code using removed syntax, or newer files using features the selected PHP cannot parse). Repair means restoring valid syntax or a known-good file, not raising memory_limit.
Common symptoms
- Log shows “PHP Parse error” or “syntax error, unexpected …” with file path and line number
- Critical-error screen or white screen immediately after editing a theme/plugin file
- Site broke right after pasting code into functions.php or a snippet plugin
- Failure appears instantly after a PHP version change while the same files worked before
- wp-admin and front end both fail when the broken file loads on every request
- A partial plugin update left a truncated .php file that cannot parse
- Syntax error points at a line that looks fine—often the real mistake is an unclosed string or brace above it
Most likely causes
- 01 Manual edit introducing missing `;`, `}`, `)`, or mismatched quotes
- 02 Snippet or functions.php paste that included WordPress shortcode or rich-text characters
- 03 Truncated or corrupt PHP file after failed SFTP/upload or disk-full write
- 04 PHP version change rejecting syntax the previous version accepted (or vice versa)
- 05 Merged conflict markers (`<<<<<<<`) left inside a deployed PHP file
- 06 Plugin/theme package incomplete after interrupted update
- 07 Copy/paste from a blog that wrapped code in smart quotes or omitted opening `<?php`
What changed before the problem started
- Direct edit to functions.php, a plugin file, or wp-config.php
- New or edited code snippet in a snippets plugin
- PHP version upgraded or downgraded in the hosting panel
- Plugin/theme update that did not finish writing files
- Deployment or git merge that left conflict markers
- Restore from backup that mixed PHP versions and file sets
Troubleshooting steps
- 01
Read the parse error file and line
From the host error log or debug.log, copy the PHP Parse error / syntax error line. Note the full path—theme, plugin, mu-plugin, or snippet storage. Do not start by reinstalling WordPress core if the path is under wp-content. Success signal: you know exactly which file PHP rejected.
- 02
Restore a known-good copy of that file
Replace the broken file from a backup, original plugin/theme zip, or host file-manager revision history. If you only edited functions.php, restore that single file first. Success signal: the parse error disappears and the site loads.
- 03
Disable the broken plugin or snippet if you cannot restore yet
Rename the plugin folder via FTP, or disable the snippet plugin’s files, or switch to a default theme if the active theme’s functions.php is the culprit (after confirming a default theme is present). Success signal: WordPress boots; only the broken component remains offline.
- 04
Roll back PHP when the error started at a version switch
Return to the previous PHP version in MultiPHP / Plesk, retest, then fix syntax or update plugins on staging before trying the newer PHP again. Success signal: parse errors clear on the restored handler.
- 05
Re-apply intentional code changes carefully
If you still need the customization, paste into a staging copy first, use a real PHP-aware editor, and avoid Word/Google-Docs quotes. Prefer a small custom plugin over editing parent theme files. Success signal: staging loads with the change; then deploy the tested file.
- 06
Confirm logs stay clean on key URLs
Load the homepage, a post, and wp-admin. Recheck the error log for new parse errors. Clear page cache so you are not staring at a cached failure page. Success signal: no new E_PARSE lines after several requests.
When to stop troubleshooting
Escalate if the parse error points into WordPress core and keeps returning after a clean core verify, multiple unrelated files fail parsing (possible bad deploy or encoding), you cannot access logs or FTP, or malware-like obfuscated PHP appears in the broken file. Bring the exact parse line, PHP version, and what was edited.
Information to collect before requesting help
- 01 Exact PHP Parse error / syntax error line with file path
- 02 PHP version currently selected in the host panel
- 03 Whether someone edited functions.php, a snippet, or a plugin file recently
- 04 Whether a PHP version change happened just before the outage
- 05 Availability of backups or original plugin/theme zips
- 06 Whether only one site/path fails or the whole account
- 07 Hosting access method (File Manager, SFTP, SSH)
How a professional repairs the problem
We locate the file PHP cannot parse, restore service by replacing or disabling that code, and confirm WordPress loads under the intended PHP version. Then we re-introduce needed customizations on staging with linting, or update incompatible plugins so production stops depending on a fragile paste. You get a short report of which file broke and how to edit safely next time.
Frequently asked questions
How is a parse error different from a fatal error? +
Can a parse error come from the database? +
Why does the line number look wrong? +
Will raising memory_limit fix a parse error? +
Did changing PHP versions cause this? +
Is it safe to edit functions.php on production? +
Repair dispatch
Still Need Help Fixing Your Website?
If you are not comfortable editing website files, changing server settings, repairing a database, or troubleshooting a live website, professional help may prevent additional damage or downtime. We will review the problem before accepting the repair.
- You will receive a clear explanation of the likely cause.
- We will tell you if the issue falls outside our repair scope.
- No additional work will be performed without approval.
- A backup should be created whenever access and website condition allow it.
Do not share passwords through an unencrypted contact form — use Password Pusher (self-destructing link). Prefer a dedicated Rescue 404 admin account, not your personal owner login; if you cannot create one yet, we will add ours after repair.