We use cookies to make your viewing experience better. By accepting you consent, you agree to our Cookie policy
Running a Craft CMS site smoothly requires vigilance. Downtime and performance issues directly impact revenue and reputation. This guide provides admins the essential troubleshooting techniques to monitor and maintain a healthy, high-performing Craft implementation. Learn to track down errors, optimize speed, validate functionality, tune the database, test backups, and keep your CMS running properly.
To ensure Craft CMS is running properly, routinely check the Control Panel logs for errors, monitor page load times and database performance, test forms and functionality manually and with automation, validate backups are completing, and set up alerts for failures. Proactive monitoring and testing will minimize downtime and issues.
To troubleshoot issues in Craft CMS, the first step is accessing the main error logs. There are three key log files to check - the Craft logs, PHP logs, and web server logs (such as Nginx or Apache).
The Craft logs can be accessed directly through the control panel by navigating to Settings > Logs. This shows any PHP errors, 404 errors, or other issues logged by Craft. Clicking on a log entry shows more details like the full stack trace for that request.
For lower level PHP errors and exceptions, enable Dev Mode under Settings > General in the control panel. This logs verbose debug messages to craft/storage/logs/phperrors.log that help diagnose problems.
To access web server and PHP logs, you'll need SSH access to the server itself. For Nginx on Linux, errors are logged to /var/log/nginx/error.log. For Apache, check /var/log/apache2/error.log or wherever your global Apache logs are configured.
PHP itself also does its own error logging when configured properly. The main log is at /var/log/php-fpm.log or wherever PHP-FPM is configured to log. Enabling log_errors and display_errors in php.ini provides more verbose logging.
So in summary, the key Craft and PHP error logs can be found in the following locations:
Craft Control Panel → Settings → Logs
craft/storage/logs/
/var/log/nginx/error.log
/var/log/apache2/error.log
/var/log/php-fpm.log
Checking all of these logs provides a comprehensive view of issues affecting a Craft site, both from the PHP and web server side.
When reviewing the Craft and web server error logs, there are a few common errors to watch out for:
404 errors - These indicate requests for invalid URLs or missing resources. Check the Craft logs for the 404s.
500 errors - These point to PHP exceptions and server issues. The PHP logs and web server logs will provide the stack trace.
Timeouts - If pages time out loading, it's likely a PHP-FPM or server resource limitation. The Craft and PHP logs can help narrow this down.
Database errors - Things like deadlocks and connectivity issues will get logged by Craft. Inspect the database credentials and configuration.
PHP exceptions - These are logged to the Craft logs and phperrors.log. Look at the exception message and stack trace for clues.
White screens - When a fatal PHP error occurs, a blank white screen can display. The PHP error logs then become critical to debugging it.
Analyzing the error patterns over time is key - for example, spikes in traffic resulting in timeouts and 500 errors point to server resources being overloaded.
Always trace back through the full stack trace for a 500 error or exception - scan through the entire call sequence leading up to the error event. This helps locate the true source in code triggering it.
To diagnose issues more easily, enable verbose Craft and PHP logging.
In Craft's General config settings, choose the "Dev" environment. This enables debug toolbar information.
For lower level logging, edit craft/config/general.php and add:
'enableTemplateCaching' => false,
'devMode' => true
This disables caching and adds file/line numbers to stack traces.
Next, enable full PHP error reporting by adding these lines to php.ini:
error_reporting = E_ALL
display_errors = On
log_errors = On
Finally, create a phperrors.log file writable by PHP to log to:
sudo touch /var/log/phperrors.log
sudo chown www-data:www-data /var/log/phperrors.log
Restart PHP-FPM and Craft. Now all errors will log verbosely. Check phperrors.log to see exceptions and debugging details.
With these settings applied, the Craft and PHP logs will contain all the details needed to quickly troubleshoot errors, exceptions, and unexpected behavior. The key is enabling verbose logging and then tracing back through the logs to pinpoint the ultimate source. Detailed logging is invaluable for diagnosing Craft CMS issues efficiently.
To monitor Craft CMS site performance, the first key metric is page load time. Tools like PageSpeed Insights and WebPageTest provide free analysis of page speeds.
Run these regularly on important site pages and record the results over time. Watch for any sudden spikes in load times that could indicate a new bottleneck.
PageSpeed Insights grades on metrics like:
First Contentful Paint - when content first renders
Time to Interactive - when page becomes usable
Total Page Load - full load time
Aim for scores above 90/100 to maintain fast page loads.
For more advanced testing, WebPageTest provides detailed timing breakdowns. Measure TTFB (Time To First Byte), requests, and other granular timings.
Set up monitoring checks weekly. Compare trends to catch degrading performance quickly before customers notice.
Response times above 1 second will negatively impact engagement. Continuously optimise to keep pages fast for a smooth user experience.
When page load times worsen, use profiling tools to identify the culprit. Common Craft CMS bottlenecks include:
Uncached full page requests - enable Craft's template caching.
Slow database queries - optimise slow queries, add indexes.
Server load - tune PHP-FPM config, increase memory.
Asset generation - optimise image sizes, leverage CDNs.
Third party scripts - defer/async JS, remove unnecessary code.
Profile with the Craft debug toolbar and Debugger plugin enabled to pinpoint sluggish requests and queries.
For the frontend, use the Network tab in browser DevTools. Analyse requests and timings to spot assets slowing pages down.
Troubleshoot the biggest issues first - address problems like uncached pages for the biggest speed gains.
Keep monitoring page speeds to validate fixes and spot any new bottlenecks as they emerge.
To correlate speed to the user experience, integrate analytics like Google Analytics with Craft.
Track key metrics like:
Pages per visit
Bounce rate
Time on site
Conversions
Monitor weekly. Sudden drops in traffic or engagement may indicate site speed or stability issues.
Compare load time trends to metrics like bounce rate. If speeds increase and engagement decreases, site performance is likely the cause.
Analytics can also highlight landing pages with high bounce rates. Check those page speeds closely to improve conversions.
For critical user journeys with high abandonment, prioritise page speed optimisations on those paths. Faster key pages can directly increase goal conversions.
Analytics integration provides the full picture - speed metrics coupled with user engagement data. Monitor both to catch Craft CMS performance regressions before they significantly impact customers and business.
With proactive tracking of page speeds, diagnosing of bottlenecks, and analytics correlation, performance can be continually tuned to deliver fast, frictionless browsing experiences.
Thoroughly testing Craft CMS implementations is crucial before launch. Manually verify key frontend functionality including:
User registration and login flows
Form submissions and validation
Checkout and payments
Content editing
Admin dashboard access
Follow critical user journeys step-by-step to validate intended behavior.
For forms, check validation triggers properly for invalid inputs. Test successful submissions result in expected outcomes like new user creation.
In the control panel, verify editor permissions allow appropriate content access. Check entries are saving as drafts properly before publishing.
Rigorously test every integration like payment gateways. Validate real transactions succeed as expected in a staging environment first.
Cross-browser testing is also vital to catch styling and behavior differences across devices. Test on mobile, tablet, and desktop widths.
Leverage tools like browserstack to efficiently validate across multiple OS, browser, and device combinations.
Allocate time for comprehensive manual testing cycles both before launch and with each new release. Following best practice validation processes will greatly reduce bugs reaching production.
To accelerate validation, automate repetitive test cases using CI/CD pipelines.
Script critical user journeys using Selenium with a test framework like PHPUnit. Re-run these for every code change to automatically catch regressions.
Some examples of key flows to automate:
User login and logout
New user registration
Checkout with test payments
Content editing and publishing
Start small with basic smoke tests for priority cases. Expand over time to eventually cover 80%+ of journeys.
Set up daily scheduled test runs to validate ongoing site stability. If tests fail, fix issues before deploying new code.
Automated tests provide rapid feedback on the impact of changes. This enables continuously improving quality while reducing manual testing overhead.
Leverage Craft CMS staging environments to safely test fixes and debug issues pre-production.
If a bug surfaces in live, first reproduce it in the staging clone. Debug and test fixes there without impacting real users.
Key steps include:
Replicate data needed to trigger issue
Confirm bug reproduces in staging too
Incrementally test potential solutions
Observe fix working as intended
Deploy fix to production after validation
Staging environments minimize disruptions when things go wrong. Protect production uptime by keeping staging as an identical parallel instance for pre-testing.
For new features, test comprehensively in staging first under real usage conditions. Monitor performance impact and catch bugs before public release.
With a robust staging environment strategy, development workflows become safer, more efficient, and higher quality.
Since Craft CMS relies on MySQL/Postgres for data storage, monitoring database connectivity is essential. Use tools like phpMyAdmin to validate connections.
Key checks include:
Login to MySQL/Postgres server - validate credentials work
Review open connections - look for Craft app connections
Check connection logs - inspect for failures
Test queries directly - rule out PHP connectivity issues
If the database is unavailable, Craft will be unable to load. Quickly diagnose connectivity drops using status tools and logs.
Common issues include:
Database server is down
Network failure between app and database servers
Invalid database credentials in Craft config
User permissions denying Craft database access
Restore connections by troubleshooting server availability, network routes, credentials, and user privileges.
Aim for zero connection failures - validate connectivity regularly as part of proactive monitoring.
Slow database queries degrade Craft CMS performance. Enable SQL logging in Craft to capture all queries.
Review frequently executed queries for speed optimizations:
Add indexes to improve JOINs and WHEREs
Tune slow queries by adding limits, removing filesorts
Enable caching to avoid heavy queries on each page load
In the Logs section, Craft lists the 10 slowest queries over the last request. Optimise these queries first to gain the biggest speed boost.
For deeper analysis, use tools like phpMyAdmin> and enable the Slow Query Log in MySQL.
Dig into metrics like total query time and number of rows examined. Identify the most critical optimization opportunities.
Improving database response time alleviates load and boosts performance for a smoother Craft CMS experience.
Along with optimizing slow queries, monitor for failed database queries that cause 500 errors.
Enable general and slow query logging in Craft and MySQL/Postgres. Review logs to catch intermittent failed queries.
Investigate patterns like:
Spikes in errors during traffic peaks - indication of query/index tuning needed
Queries failing only at intervals - possible cron job issue
Specific query types failing - bug in query logic
In Craft, fix failed queries by:
Retrying after tuning database speed
Adjusting query logic if flawed
Handling errors gracefully in code
For MySQL errors like max connection timeouts, tune database server resources.
Quickly detecting and debugging failed queries minimizes their impact on Craft CMS reliability and uptime.
Proactively monitoring database performance holistically across connectivity, speed, and failures ensures Craft CMS's backend data layer stays robust.
Craft CMS backups are critical for protecting against data loss. For scheduled jobs, routinely confirm backups are completing successfully.
Review the last run time and logs within the control panel at Settings > Backups. Look for any errors during backup.
Also check the actual backup files written to the disk at craft/storage/backups/. Validate recent files exist with expected timestamps.
For remote backups like to S3, login to the storage directly to confirm backups are present. Test downloading a backup to validate completeness.
Set up email, Slack or SMS alerts on backup failures. Be notified immediately if a job fails to run. Troubleshoot and re-run failed backups promptly.
Monitor retention and available storage for backups over time. Craft can quickly consume gigs of space with asset uploads.
Keep only limited backup history locally while archiving older backups remotely. Preserve critical point-in-time restore ability without filling up disks.
In addition to verifying automated scheduled backups, do hands-on manual restores regularly as disaster recovery tests.
Follow best practices like:
Backup production database and files
Import backup into fresh Craft CMS install locally
Confirm site restores and functions properly
Delete test instance after validation
Doing a full restore ensures your backup strategy actually works when needed most. Catch any gaps like missed files or assets.
Test different points in time like a week old backup. Validate no data corruption exists that could get restored unintentionally.
Practice backup and restores regularly on staging environments so the process is familiar when critical.
To avoid nasty surprises, configure alerts for failed Craft CMS backups that notify immediately.
Setup integrations to:
Email admins directly on any backup failures
Send SMS alerts for urgent out-of-hours notifications
With real-time alerts, failed backups can be quickly investigated and re-run before the next scheduled job.
Periodically confirm alert delivery by intentionally triggering a failure and validation the alert sends. Log alert failures as incidents for root cause analysis.
Backup alerts minimize the risk of data loss by enabling prompt response. With robust monitoring and alerting, Craft data stays protected.
Proactive validation, testing, and alerting provides assurance the CMS can be restored when disaster strikes. Follow leading practices to lock down backups for true disaster recovery.
Andy has scaled multiple businesses and is a big believer in Craft CMS as a tool that benefits both Designer, Developer and Client.