Debug PHP errors
By default ShopClass keeps PHP quiet: notices and strict warnings are suppressed so a visitor never sees them. That is right for production and unhelpful the moment something breaks.
Two constants in config.php change it. They can also come from the environment (OSC_DEBUG=1, OSC_DEBUG_LOG=1), which is how a Docker site sets them. OSC_DEBUG_LOG alone turns debug on too. On Apache, oc-content/.htaccess denies *.log files so debug.log cannot be downloaded; the nginx image blocks it in its config.
Show errors on screen
Section titled “Show errors on screen”define('OSC_DEBUG', true);Error reporting rises to E_ALL | E_STRICT and display_errors is turned on,
so PHP prints what went wrong instead of a blank page.
With OSC_DEBUG off (the default), PHP reports only fatal and parse errors and
warnings: E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING.
Log errors to a file
Section titled “Log errors to a file”Better on a live site, because visitors see nothing:
define('OSC_DEBUG', true);define('OSC_DEBUG_LOG', true);Errors are written to oc-content/debug.log.
If the file does not appear, the web server cannot create it. Create it yourself and make it writable by the web-server user:
touch oc-content/debug.logchmod 664 oc-content/debug.logThen watch it while you reproduce the problem:
tail -f oc-content/debug.logDebugging a white screen
Section titled “Debugging a white screen”A blank page means PHP died before it could print anything, usually a fatal error with display off.
- Set
OSC_DEBUGandOSC_DEBUG_LOGas above. - Reload the page and read
oc-content/debug.log. - If the log is still empty, PHP failed before ShopClass loaded: a syntax
error in
config.php, or an out-of-memory kill. Check your server’s PHP error log; your host’s control panel will point at it.
Common causes, in the order they are worth checking:
| Symptom | Usual cause |
|---|---|
| Blank page right after an update | A leftover file from an older version, or a plugin using something removed. |
| “Allowed memory size exhausted” | Raise the memory limit. |
| Blank page on one page only | A plugin hooked to that page. Disable them one at a time. |
| Blank page everywhere, admin included | config.php, the database connection, or a fatal in a plugin loaded on every request. |
To take plugins out of the picture from a shell:
php oc-cli.php plugin:listphp oc-cli.php plugin:deactivate --plugin=<folder>And to check the environment as a whole:
php oc-cli.php doctorRelated
Section titled “Related”- Debug SQL queries: when the problem is the database rather than the code.