---
title: "Troubleshooting PHP"
date: "2015-01-09"
category: "php"
slug: "troubleshooting-php"
---

This article covers common reasons PHP scripts may fail or behave unexpectedly.

## Empty Pages

### Compiler Errors

By default, PHP does not display compile-time errors in the browser. Errors are instead [[accessing-page-views-and-error-messages]] for security. Enable browser error display with a [[htaccess-guide]] directive in the [[where-is-site-content-served-from]]:

`php_flag display_errors on`

**Resolution:**

- **Syntax errors:** Correct the mistake. Use an IDE such as [PDT](https://eclipse.org/pdt/) (free) or [PhpStorm](https://www.jetbrains.com/phpstorm/) to catch typos.
- **Upload issues:** Ensure PHP files were uploaded correctly via FTP. Some FTP clients may incorrectly resume text file transfers, resulting in corrupted files. Open a support ticket in the [[logging-into-the-control-panel]] if you suspect this.

### Bad Cache Retrieval

PHP uses an opcode cache to store compiled bytecode in memory. In rare cases, cached bytecode becomes corrupted, producing empty pages.

**Resolution:** Disable PHP caching via a [[htaccess-guide]] file in the [[where-is-site-content-served-from]]:

- [[determining-platform-version]] and newer (OPcache): `php_flag opcache.enable off`
- [[determining-platform-version]] and older (APC): `php_flag apc.cache_by_default off`

## Undefined Behavior

Unexpected behavior (e.g., uploads not saving correctly) can result from deprecated PHP features like [register\_globals](http://php.net/manual/en/security.globals.php).

**Resolution steps:**

1. Ensure you are running the latest version of the application
2. Check the [[accessing-page-views-and-error-messages]] for errors
3. Add `php_flag display_errors on` and `php_value error_reporting 99999` to a [[htaccess-guide]] file in the [[where-is-site-content-served-from]], then reproduce the issue and look for any output prefixed with "PHP Error" or "PHP Notice"
4. If the issue persists, open a support ticket in the [[logging-into-the-control-panel]] with steps to reproduce the problem
