🔍 Troubleshooting¶
Solutions to common problems and debugging techniques for XOOPS CMS.
📋 Quick Diagnosis¶
Before diving into specific issues, check these common causes:
- File Permissions - Directories need 755, files need 644
- PHP Version - Ensure PHP 7.4+ (8.x recommended)
- Error Logs - Check
xoops_data/logs/and PHP error logs - Cache - Clear cache in Admin → System → Maintenance
🗂️ Section Contents¶
Common Issues¶
- White Screen of Death (WSOD)
- Database Connection Errors
- Permission Denied Errors
- Module Installation Failures
- Template Compilation Errors
FAQ¶
Debugging¶
🚨 Common Issues & Solutions¶
White Screen of Death (WSOD)¶
Symptoms: Blank white page, no error message
Solutions:
-
Enable PHP error display temporarily:
-
Check PHP error log:
-
Common causes:
- Memory limit exceeded
- Fatal PHP syntax error
-
Missing required extension
-
Fix memory issues:
Database Connection Errors¶
Symptoms: "Unable to connect to database" or similar
Solutions:
-
Verify credentials in mainfile.php:
-
Test connection manually:
-
Check MySQL service:
-
Verify user permissions:
Permission Denied Errors¶
Symptoms: Cannot upload files, cannot save settings
Solutions:
-
Set correct permissions:
-
Set correct ownership:
-
Check SELinux (CentOS/RHEL):
Module Installation Failures¶
Symptoms: Module won't install, SQL errors
Solutions:
- Check module requirements:
- PHP version compatibility
- Required PHP extensions
-
XOOPS version compatibility
-
Manual SQL installation:
-
Clear module cache:
-
Check xoops_version.php syntax:
Template Compilation Errors¶
Symptoms: Smarty errors, template not found
Solutions:
-
Clear Smarty cache:
-
Check template syntax:
-
Verify template exists:
-
Regenerate templates:
- Admin → System → Maintenance → Templates → Regenerate
🐛 Debugging Techniques¶
Enable XOOPS Debug Mode¶
// In mainfile.php
define('XOOPS_DEBUG_LEVEL', 2);
// Levels:
// 0 = Off
// 1 = PHP debug
// 2 = PHP + SQL debug
// 3 = PHP + SQL + Smarty templates
Using Ray Debugger¶
Ray is an excellent debugging tool for PHP:
// Install via Composer
composer require spatie/ray --dev
// Usage in your code
ray($variable);
ray($object)->expand();
ray()->measure();
// Database queries
ray($sql)->label('Query');
Smarty Debug Console¶
Database Query Logging¶
// Enable query logging
$GLOBALS['xoopsDB']->setLogger(new XoopsLogger());
// Get all queries
$queries = $GLOBALS['xoopsLogger']->queries;
foreach ($queries as $query) {
echo $query['sql'] . " - " . $query['time'] . "s\n";
}
❓ Frequently Asked Questions¶
Installation¶
Q: Installation wizard shows blank page A: Check PHP error logs, ensure PHP has enough memory, verify file permissions.
Q: Cannot write to mainfile.php during installation A: Set permissions: chmod 666 mainfile.php during installation, then chmod 444 after.
Q: Database tables not created A: Check MySQL user has CREATE TABLE privileges, verify database exists.
Modules¶
Q: Module admin page is blank A: Clear cache, check module's admin/menu.php for syntax errors.
Q: Module blocks not showing A: Check block permissions in Admin → Blocks, verify block is assigned to pages.
Q: Module update fails A: Backup database, try manual SQL updates, check version requirements.
Themes¶
Q: Theme not applying correctly A: Clear Smarty cache, check theme.html exists, verify theme permissions.
Q: Custom CSS not loading A: Check file path, clear browser cache, verify CSS syntax.
Q: Images not displaying A: Check image paths, verify uploads folder permissions.
Performance¶
Q: Site is very slow A: Enable caching, optimize database, check for slow queries, enable OpCache.
Q: High memory usage A: Increase memory_limit, optimize large queries, implement pagination.
🔧 Maintenance Commands¶
Clear All Caches¶
#!/bin/bash
# clear_cache.sh
rm -rf xoops_data/caches/xoops_cache/*
rm -rf xoops_data/caches/smarty_cache/*
rm -rf xoops_data/caches/smarty_compile/*
echo "Cache cleared!"
Database Optimization¶
-- Optimize all tables
OPTIMIZE TABLE xoops_config;
OPTIMIZE TABLE xoops_users;
OPTIMIZE TABLE xoops_session;
-- Repeat for other tables
-- Or optimize all at once
mysqlcheck -o -u user -p database