Basic Configuration
Basic XOOPS Configuration
Section titled “Basic XOOPS Configuration”This guide covers essential configuration settings to get your XOOPS site running properly after installation.
mainfile.php Configuration
Section titled “mainfile.php Configuration”The mainfile.php file contains critical configuration for your XOOPS installation. It’s created during installation but you may need to edit it manually.
Location
Section titled “Location”/var/www/html/xoops/mainfile.phpFile Structure
Section titled “File Structure”<?php// Database Configurationdefine('XOOPS_DB_TYPE', 'mysqli'); // Database typedefine('XOOPS_DB_HOST', 'localhost'); // Database hostdefine('XOOPS_DB_USER', 'xoops_user'); // Database userdefine('XOOPS_DB_PASS', 'password'); // Database passworddefine('XOOPS_DB_NAME', 'xoops_db'); // Database namedefine('XOOPS_DB_PREFIX', 'xoops_'); // Table prefix
// Site Configurationdefine('XOOPS_ROOT_PATH', '/var/www/html/xoops'); // File system pathdefine('XOOPS_URL', 'http://your-domain.com/xoops'); // Web URLdefine('XOOPS_TRUST_PATH', '/var/www/html/xoops/var'); // Trusted path
// Character Setdefine('XOOPS_DB_CHARSET', 'utf8mb4'); // Database charsetdefine('_CHARSET', 'UTF-8'); // Page charset
// Debug Mode (set to 0 in production)define('XOOPS_DEBUG', 0); // Set to 1 for debugging?>Critical Settings Explained
Section titled “Critical Settings Explained”| Setting | Purpose | Example |
|---|---|---|
XOOPS_DB_TYPE | Database system | mysqli, mysql, pdo |
XOOPS_DB_HOST | Database server location | localhost, 192.168.1.1 |
XOOPS_DB_USER | Database username | xoops_user |
XOOPS_DB_PASS | Database password | [secure_password] |
XOOPS_DB_NAME | Database name | xoops_db |
XOOPS_DB_PREFIX | Table name prefix | xoops_ (allows multiple XOOPS on one DB) |
XOOPS_ROOT_PATH | Physical file system path | /var/www/html/xoops |
XOOPS_URL | Web accessible URL | http://your-domain.com |
XOOPS_TRUST_PATH | Trusted path (outside web root) | /var/www/xoops_var |
Editing mainfile.php
Section titled “Editing mainfile.php”Open mainfile.php in a text editor:
# Using nanonano /var/www/html/xoops/mainfile.php
# Using vivi /var/www/html/xoops/mainfile.php
# Using sed (find and replace)sed -i "s|define('XOOPS_URL'.*|define('XOOPS_URL', 'http://new-domain.com');|" /var/www/html/xoops/mainfile.phpCommon mainfile.php Changes
Section titled “Common mainfile.php Changes”Change site URL:
define('XOOPS_URL', 'https://yourdomain.com');Enable debug mode (development only):
define('XOOPS_DEBUG', 1);Change table prefix (if needed):
define('XOOPS_DB_PREFIX', 'myxoops_');Move trust path outside web root (advanced):
define('XOOPS_TRUST_PATH', '/var/www/xoops_var');Admin Panel Configuration
Section titled “Admin Panel Configuration”Configure basic settings through the XOOPS admin panel.
Accessing System Settings
Section titled “Accessing System Settings”- Log in to admin panel:
http://your-domain.com/xoops/admin/ - Navigate to: System > Preferences > General Settings
- Modify settings (see below)
- Click “Save” at bottom
Site Name and Description
Section titled “Site Name and Description”Configure how your site appears:
Site Name: My XOOPS SiteSite Description: A dynamic content management systemSite Slogan: Built with XOOPSContact Information
Section titled “Contact Information”Set site contact details:
Site Admin Email: admin@your-domain.comSite Admin Name: Site AdministratorContact Form Email: support@your-domain.comSupport Email: help@your-domain.comLanguage and Region
Section titled “Language and Region”Set default language and region:
Default Language: EnglishDefault Timezone: America/New_York (or your timezone)Date Format: %Y-%m-%dTime Format: %H:%M:%SEmail Configuration
Section titled “Email Configuration”Configure email settings for notifications and user communications.
Email Settings Location
Section titled “Email Settings Location”Admin Panel: System > Preferences > Email Settings
SMTP Configuration
Section titled “SMTP Configuration”For reliable email delivery, use SMTP instead of PHP mail():
Use SMTP: YesSMTP Host: smtp.gmail.com (or your SMTP provider)SMTP Port: 587 (TLS) or 465 (SSL)SMTP Username: your-email@gmail.comSMTP Password: [app_password]SMTP Security: TLS or SSLGmail Configuration Example
Section titled “Gmail Configuration Example”Set up XOOPS to send email via Gmail:
SMTP Host: smtp.gmail.comSMTP Port: 587SMTP Security: TLSSMTP Username: your-email@gmail.comSMTP Password: [Google App Password - NOT regular password]From Address: your-email@gmail.comFrom Name: Your Site NameNote: Gmail requires an App Password, not your Gmail password:
- Go to https://myaccount.google.com/apppasswords
- Generate app password for “Mail” and “Windows Computer”
- Use the generated password in XOOPS
PHP mail() Configuration (Simpler but Less Reliable)
Section titled “PHP mail() Configuration (Simpler but Less Reliable)”If SMTP unavailable, use PHP mail():
Use SMTP: NoFrom Address: noreply@your-domain.comFrom Name: Your Site NameEnsure your server has sendmail or postfix configured:
# Check if sendmail is availablewhich sendmail
# Or check postfixsystemctl status postfixEmail Function Settings
Section titled “Email Function Settings”Configure what triggers emails:
Send Notifications: YesNotify Admin on User Registration: YesSend Welcome Email to New Users: YesSend Password Reset Link: YesEnable User Email: YesEnable Private Messages: YesNotify on Admin Actions: YesTimezone Configuration
Section titled “Timezone Configuration”Set proper timezone for correct timestamps and scheduling.
Setting Timezone in Admin Panel
Section titled “Setting Timezone in Admin Panel”Path: System > Preferences > General Settings
Default Timezone: [Select your timezone]Common Timezones:
- America/New_York (EST/EDT)
- America/Chicago (CST/CDT)
- America/Denver (MST/MDT)
- America/Los_Angeles (PST/PDT)
- Europe/London (GMT/BST)
- Europe/Paris (CET/CEST)
- Asia/Tokyo (JST)
- Asia/Shanghai (CST)
- Australia/Sydney (AEDT/AEST)
Verify Timezone
Section titled “Verify Timezone”Check current server timezone:
# Show current timezonetimedatectl
# Or check datedate +%Z
# List available timezonestimedatectl list-timezonesSet System Timezone (Linux)
Section titled “Set System Timezone (Linux)”# Set timezonetimedatectl set-timezone America/New_York
# Or use symlink methodln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
# VerifydateURL Configuration
Section titled “URL Configuration”Enable Clean URLs (Friendly URLs)
Section titled “Enable Clean URLs (Friendly URLs)”For URLs like /page/about instead of /index.php?page=about
Requirements:
- Apache with mod_rewrite enabled
.htaccessfile in XOOPS root
Enable in Admin Panel:
- Go to: System > Preferences > URL Settings
- Check: “Enable Friendly URLs”
- Select: “URL Type” (Path Info or Query)
- Save
Verify .htaccess Exists:
cat /var/www/html/xoops/.htaccessSample .htaccess content:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /xoops/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L,QSA]</IfModule>Troubleshooting Clean URLs:
# Verify mod_rewrite enabledapache2ctl -M | grep rewrite
# Enable if neededa2enmod rewrite
# Restart Apachesystemctl restart apache2
# Test rewrite rulecurl -I http://your-domain.com/xoops/index.phpConfigure Site URL
Section titled “Configure Site URL”Admin Panel: System > Preferences > General Settings
Set correct URL for your domain:
Site URL: http://your-domain.com/xoops/Or if XOOPS is in root:
Site URL: http://your-domain.com/Search Engine Optimization (SEO)
Section titled “Search Engine Optimization (SEO)”Configure SEO settings for better search engine visibility.
Meta Tags
Section titled “Meta Tags”Set global meta tags:
Admin Panel: System > Preferences > SEO Settings
Meta Keywords: xoops, cms, content managementMeta Description: A dynamic content management systemThese appear in page <head>:
<meta name="keywords" content="xoops, cms, content management"><meta name="description" content="A dynamic content management system">Sitemap
Section titled “Sitemap”Enable XML sitemap for search engines:
- Go to: System > Modules
- Find “Sitemap” module
- Click to install and enable
- Access sitemap at:
/xoops/sitemap.xml
Robots.txt
Section titled “Robots.txt”Control search engine crawling:
Create /var/www/html/xoops/robots.txt:
User-agent: *Allow: /Disallow: /admin/Disallow: /templates_c/Disallow: /install/Disallow: /upgrade/
Sitemap: https://your-domain.com/xoops/sitemap.xmlUser Settings
Section titled “User Settings”Configure default user-related settings.
User Registration
Section titled “User Registration”Admin Panel: System > Preferences > User Settings
Allow User Registration: Yes/NoUser Registration Type: - Instant (Automatic approval) - Approval Required (Admin approval needed) - Email Verification (Email confirmation required)
Email Confirmation Required: Yes/NoAccount Activation Method: Automatic/ManualUser Profile
Section titled “User Profile”Enable User Profiles: YesShow User Avatar: YesMaximum Avatar Size: 100KBAvatar Dimensions: 100x100 pixelsUser Email Display
Section titled “User Email Display”Show User Email: No (for privacy)Users Can Hide Email: YesUsers Can Change Avatar: YesUsers Can Upload Files: YesCache Configuration
Section titled “Cache Configuration”Improve performance with proper caching.
Cache Settings
Section titled “Cache Settings”Admin Panel: System > Preferences > Cache Settings
Enable Caching: YesCache Method: File (or APCu/Memcache if available)Cache Lifetime: 3600 seconds (1 hour)Clear Cache
Section titled “Clear Cache”Clear old cache files:
# Manual cache clearrm -rf /var/www/html/xoops/cache/*rm -rf /var/www/html/xoops/templates_c/*
# From admin panel:# System > Dashboard > Tools > Clear CacheInitial Settings Checklist
Section titled “Initial Settings Checklist”After installation, configure:
- Site name and description set correctly
- Admin email configured
- SMTP email settings configured and tested
- Timezone set to your region
- URL configured correctly
- Clean URLs (friendly URLs) enabled if desired
- User registration settings configured
- Meta tags for SEO configured
- Default language selected
- Cache settings enabled
- Admin user password is strong (16+ characters)
- Test user registration
- Test email functionality
- Test file upload
- Visit homepage and verify appearance
Testing Configuration
Section titled “Testing Configuration”Test Email
Section titled “Test Email”Send a test email:
Admin Panel: System > Email Test
Or manually:
<?phprequire_once __DIR__ . '/mainfile.php';require_once XOOPS_ROOT_PATH . '/class/mail/phpmailer/class.phpmailer.php';
$mailer = xoops_getMailer();$mailer->addRecipient('admin@your-domain.com');$mailer->setSubject('XOOPS Email Test');$mailer->setBody('This is a test email from XOOPS');
if ($mailer->send()) { echo "Email sent successfully!";} else { echo "Failed to send email: " . $mailer->getError();}?>Test Database Connection
Section titled “Test Database Connection”<?phprequire_once __DIR__ . '/mainfile.php';
$connection = XoopsDatabaseFactory::getDatabaseConnection();if ($connection) { echo "Database connected successfully!"; $result = $connection->query("SELECT COUNT(*) FROM " . $connection->prefix("users")); if ($result) { echo "Query successful!"; }} else { echo "Database connection failed!";}?>Important: Delete test files after testing!
rm /var/www/html/xoops/test-*.phpConfiguration Files Summary
Section titled “Configuration Files Summary”| File | Purpose | Edit Method |
|---|---|---|
| mainfile.php | Database and core settings | Text editor |
| Admin Panel | Most settings | Web interface |
| .htaccess | URL rewriting | Text editor |
| robots.txt | Search engine crawling | Text editor |
Next Steps
Section titled “Next Steps”After basic configuration:
- Configure system settings in detail
- Harden security
- Explore admin panel
- Create your first content
- Set up user accounts
Tags: #configuration #setup #email #timezone #seo
Related Articles:
- ../Installation/Installation
- System-Settings
- Security-Configuration
- Performance-Optimization