# Server error (500) on your site

> Find the cause of a 500 Internal Server Error in the error and PHP logs, then fix it with a setting change, a restart, or a rollback.

Source: https://docs.wpwaterfall.com/troubleshooting-server-errors

A 500 error means PHP or WordPress failed while it built the page. The web server is fine, so the fix is in the code, a plugin, the PHP settings, or the database. The error log names the cause in most cases.

## How do I find the cause?

1. Open the site, then **Logs**, and pick `php-error.log`. Filter by Error. Copy the first fatal line. It names the file and line that failed.
2. In the same log, look for PHP-FPM pool messages. A worker that ran out of memory or restarted means PHP ran short. Then pick `error.log` to see Nginx errors, such as upstream timeouts.
3. Open **User Activity** and **Deploys** on **Info**. If the 500 started with a deploy, a plugin update, or a PHP change, that change is the first suspect.

## How do I fix it?

- **Plugin or theme fault.** Deactivate the plugin named in the error from wp-admin, or rename its folder over SFTP. Reactivate it after the fix. Try changes on staging first if you can.
- **PHP memory error.** Open **Tools**, then **PHP settings**, and raise the memory limit one step. Change one setting at a time, then restart PHP from **Tools**.
- **Bad deploy.** On live's **Info** page, open **Deploys** and roll back to the release before the change. Rollback changes code only.
- **PHP version change.** Switch back under **Tools**, then test plugins one by one on staging before you switch again.
- **Database error.** See [Database connection errors](https://docs.wpwaterfall.com/troubleshooting-database-connection).

## Still stuck

Message Nami from the chat button with the site name, the environment, the time of the errors, the first fatal line from `php-error.log`, and the job ID of any recent deploy.

## Related

- [View logs](https://docs.wpwaterfall.com/logs-viewer)
- [Change PHP settings](https://docs.wpwaterfall.com/tools-php-settings)
- [Plugins](https://docs.wpwaterfall.com/plugins)
- [Deploys and rollback](https://docs.wpwaterfall.com/code-tab)
- [Restart PHP](https://docs.wpwaterfall.com/tools-settings)
- [Troubleshooting: 502 after a deploy](https://docs.wpwaterfall.com/troubleshooting-502-after-deploy)
