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.
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 — the level is
E_ALL ^ E_NOTICE ^ E_USER_NOTICE.
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.