# Installation Guide

> **Multilingual Press Zone** - Enterprise-grade multilingual CMS for WordPress

---

## System Requirements

Before installing Multilingual Press Zone, ensure your server meets these minimum requirements:

### Required

- **WordPress**: 6.0 or higher
- **PHP**: 8.3 or higher
- **MySQL**: 8.0 or higher (or MariaDB 10.6+)
- **Memory Limit**: 128MB minimum (256MB recommended)
- **Disk Space**: 50MB minimum

### Recommended

- **Object Cache**: Redis or Memcached for optimal performance
- **PHP Extensions**:
  - `mbstring` (for UTF-8 support)
  - `intl` (for locale handling)
  - `json` (for API operations)
- **Server**: Nginx or Apache with mod_rewrite enabled
- **SSL Certificate**: HTTPS recommended for security

### Compatibility

✅ **Compatible With:**
- WordPress Multisite
- WooCommerce 7.0+
- Advanced Custom Fields (ACF)
- Yoast SEO
- Rank Math SEO
- Elementor
- Beaver Builder
- WP Rocket
- LiteSpeed Cache

❌ **Not Compatible With:**
- WPML (must be removed before installation)
- Polylang (migration required)
- WordPress < 6.0
- PHP < 8.3

---

## Installation Methods

### Method 1: WordPress.org Repository (Recommended)

1. **Navigate to Plugins**
   - Log into your WordPress admin dashboard
   - Go to **Plugins → Add New**

2. **Search for Plugin**
   - In the search box, type: `Multilingual Press Zone`
   - Find the plugin by Press.Zone

3. **Install Plugin**
   - Click the **Install Now** button
   - Wait for installation to complete

4. **Activate Plugin**
   - Click the **Activate** button
   - You'll be redirected to the welcome wizard

### Method 2: Upload ZIP File

1. **Download Plugin**
   - Download the plugin ZIP from [press.zone/multilingual](https://press.zone/multilingual)
   - Save the file to your computer

2. **Upload to WordPress**
   - Go to **Plugins → Add New → Upload Plugin**
   - Click **Choose File** and select the downloaded ZIP
   - Click **Install Now**

3. **Activate Plugin**
   - After installation completes, click **Activate Plugin**
   - Follow the welcome wizard

### Method 3: FTP/SFTP Upload

1. **Extract ZIP File**
   - Unzip the downloaded plugin file
   - You'll get a folder named `multilingual-press-zone`

2. **Upload via FTP**
   - Connect to your server via FTP/SFTP
   - Navigate to `/wp-content/plugins/`
   - Upload the `multilingual-press-zone` folder

3. **Activate Plugin**
   - Go to **Plugins** in WordPress admin
   - Find **Multilingual Press Zone** and click **Activate**

### Method 4: WP-CLI (For Developers)

```bash
# Install from WordPress.org
wp plugin install multilingual-press-zone --activate

# Or install from ZIP file
wp plugin install /path/to/multilingual-press-zone.zip --activate

# Check installation status
wp plugin status multilingual-press-zone
```

---

## First-Time Setup Wizard

After activation, you'll be automatically redirected to the setup wizard.

### Step 1: Welcome

- Introduction to Multilingual Press Zone
- Quick overview of key features
- System requirements verification

**Action:** Click **Get Started** to continue

### Step 2: License Activation

Choose your license tier:

| License | Price | Features |
|---------|-------|----------|
| **Starter** | $50/year | 5 languages, 10K posts, Community support |
| **Professional** | $120/year | 10 languages, 100K posts, Priority support |
| **Enterprise** | $350/year | Unlimited, 24/7 support, SLA |

**To Activate:**
1. Enter your license key (received via email after purchase)
2. Click **Activate License**
3. Confirmation message will appear

**Free Trial:** 14-day trial available for all tiers - no credit card required.

### Step 3: Add Languages

Select your default language and add additional languages:

1. **Default Language** (required)
   - Usually your site's primary language
   - Example: English (en_US)

2. **Additional Languages** (optional)
   - Click **Add Language** for each language you need
   - Configure URL structure:
     - **Subdirectory**: `example.com/es/` (recommended)
     - **Subdomain**: `es.example.com` (requires DNS setup)
     - **Parameter**: `example.com/?lang=es` (SEO not ideal)

**Popular Language Combinations:**
- English + Spanish + French
- English + German + Italian
- English + Chinese + Japanese

### Step 4: Configure Settings

Basic settings to get started:

- **URL Structure**: How language URLs are formatted
- **Language Detection**: Auto-detect from browser settings
- **Fallback Language**: What to show if translation missing
- **RTL Support**: Enable for Arabic, Hebrew, etc.

### Step 5: Translate First Content

Try translating your first post or page:

1. Select a post from your recent posts
2. Choose target language
3. Click **Create Translation**
4. Edit the translated content
5. Click **Publish**

### Step 6: Complete Setup

- ✅ Database tables created
- ✅ Default language configured
- ✅ License activated
- ✅ First translation created

**Next Steps:**
- [Configure translation workflow](workflow-system.md)
- [Add language switcher to your site](../guides/language-switcher.md)
- [Watch video tutorials](../videos/quick-start.md)

---

## Post-Installation Checks

### Verify Installation

Run these checks to ensure everything is working:

#### 1. Check Database Tables

```bash
# Via WP-CLI
wp db query "SHOW TABLES LIKE 'wp_mpz_%'"

# Expected output:
# wp_mpz_languages
# wp_mpz_translations
# wp_mpz_string_translations
```

#### 2. Check Plugin Version

```bash
# Via WP-CLI
wp option get mpz_version

# Expected output: 1.0.0 (or current version)
```

#### 3. Check Default Language

```bash
# Via WP-CLI
wp db query "SELECT * FROM wp_mpz_languages WHERE is_default = 1"

# Expected: English (en_US) language record
```

#### 4. Check Cache Status

Navigate to **Settings → Multilingual Press Zone → Performance**

- **Memory Cache**: Should show "Active"
- **Object Cache**: Should show "Active" if Redis/Memcached installed
- **Hit Ratio**: Should be > 80% after some usage

#### 5. Check Frontend

Visit your site's homepage:
- Language switcher should appear (if widget added)
- URLs should use correct structure
- No PHP errors in debug log

---

## Troubleshooting Installation Issues

### Issue: "PHP version too low"

**Error:** `Multilingual Press Zone requires PHP 8.3 or higher`

**Solution:**
1. Contact your hosting provider to upgrade PHP
2. Or use PHP version switcher in cPanel/Plesk
3. Recommended: PHP 8.3 or 8.4

### Issue: "WordPress version too low"

**Error:** `Multilingual Press Zone requires WordPress 6.0 or higher`

**Solution:**
1. Backup your site first
2. Go to **Dashboard → Updates**
3. Click **Update Now**
4. Test your site thoroughly
5. Then retry plugin installation

### Issue: "Database tables not created"

**Symptoms:** Plugin activates but doesn't work

**Solution:**
```bash
# Check database permissions
wp db query "SHOW GRANTS"

# Manually trigger table creation
wp eval "require_once 'wp-content/plugins/multilingual-press-zone/includes/Core/Database.php';
  \$db = new \MultilingualPressZone\Core\Database();
  \$db->create_tables();"

# Verify tables exist
wp db query "SHOW TABLES LIKE 'wp_mpz_%'"
```

### Issue: "License activation failed"

**Common Causes:**
- Invalid license key
- Site already activated on another domain
- Network connectivity issue

**Solution:**
1. Check license key (copy-paste carefully)
2. Verify site URL matches license
3. Check firewall isn't blocking api.press.zone
4. Contact support if issue persists

### Issue: "Memory limit exhausted"

**Error:** `Fatal error: Allowed memory size exhausted`

**Solution:**

Edit `wp-config.php`:
```php
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
```

Or edit `.htaccess`:
```apache
php_value memory_limit 256M
```

Or edit `php.ini`:
```ini
memory_limit = 256M
```

### Issue: "Conflicts with other plugins"

**Symptoms:** White screen, errors, features not working

**Solution:**
1. Deactivate all plugins except Multilingual Press Zone
2. Test if issue persists
3. Reactivate plugins one by one
4. Identify conflicting plugin
5. Report to support with plugin details

**Known Conflicts:**
- WPML (must be removed)
- Polylang (use migration tool)
- Old translation plugins

### Issue: "404 errors on translated pages"

**Solution:**
```bash
# Flush rewrite rules
wp rewrite flush

# Or via admin
# Settings → Permalinks → Save Changes (no changes needed)
```

---

## Multisite Installation

### Network-Wide Installation

For WordPress Multisite networks:

1. **Upload Plugin**
   - Upload to `/wp-content/plugins/` via FTP
   - Or install via **Network Admin → Plugins → Add New**

2. **Network Activate**
   - Go to **Network Admin → Plugins**
   - Find Multilingual Press Zone
   - Click **Network Activate**

3. **Configure Per Site**
   - Each site can have different languages
   - License validation happens per site
   - Settings are site-specific

### Per-Site Installation

1. Enable plugin management for sites:
   ```php
   // In wp-config.php
   define('WPMU_PLUGIN_DIR', 'plugins');
   ```

2. Allow individual sites to activate:
   - Go to **Network Admin → Settings → Network Settings**
   - Check **Enable administration menus**
   - Click **Save Changes**

3. Site admins can now activate the plugin individually

---

## Migrating from WPML

If you're currently using WPML, follow our [WPML Migration Guide](../guides/wpml-migration.md) for a smooth transition.

### Quick Migration Steps

1. **Backup Everything**
   - Database backup
   - File backup
   - Export WPML settings

2. **Install Multilingual Press Zone**
   - Keep WPML active during installation

3. **Run Migration Wizard**
   - Go to **Settings → Multilingual Press Zone → Import**
   - Click **Import from WPML**
   - Follow wizard instructions

4. **Verify Translations**
   - Check all languages imported
   - Verify content relationships
   - Test language switching

5. **Deactivate WPML**
   - Only after full verification
   - Keep backup for 30 days

**Success Rate:** 99.8% of migrations complete successfully

---

## Server Configuration

### Apache Configuration

Ensure mod_rewrite is enabled:

```apache
# .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Language subdirectory support
RewriteRule ^(en|es|fr|de|it)/(.*)$ /index.php?lang=$1&path=$2 [QSA,L]
</IfModule>
```

### Nginx Configuration

```nginx
# nginx.conf
server {
    listen 80;
    server_name example.com;

    root /var/www/html;
    index index.php;

    # Language subdirectory support
    location ~ ^/(en|es|fr|de|it)/ {
        try_files $uri $uri/ /index.php?$args;
    }

    # PHP handling
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}
```

### Redis Configuration (Optional)

For optimal performance, install Redis object cache:

1. **Install Redis Server**
   ```bash
   # Ubuntu/Debian
   sudo apt-get install redis-server php8.3-redis

   # CentOS/RHEL
   sudo yum install redis php83-redis
   ```

2. **Install WordPress Redis Plugin**
   ```bash
   wp plugin install redis-cache --activate
   wp redis enable
   ```

3. **Verify Cache Working**
   ```bash
   wp redis status
   ```

---

## Security Hardening

### File Permissions

```bash
# Set correct permissions
find /path/to/wordpress -type d -exec chmod 755 {} \;
find /path/to/wordpress -type f -exec chmod 644 {} \;

# Secure wp-config.php
chmod 600 wp-config.php
```

### Disable File Editing

Add to `wp-config.php`:
```php
define('DISALLOW_FILE_EDIT', true);
```

### Enable HTTPS

```php
// Force HTTPS for admin
define('FORCE_SSL_ADMIN', true);

// Force HTTPS for entire site
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] != 'https') {
    wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301);
    exit();
}
```

---

## Performance Optimization

### PHP OpCache

Enable in `php.ini`:
```ini
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
```

### MySQL Optimization

```sql
-- Increase query cache (if MySQL < 8.0)
SET GLOBAL query_cache_size = 67108864;

-- Optimize plugin tables weekly
OPTIMIZE TABLE wp_mpz_languages, wp_mpz_translations, wp_mpz_string_translations;
```

### WordPress Configuration

```php
// wp-config.php optimizations
define('WP_CACHE', true);
define('CONCATENATE_SCRIPTS', true);
define('COMPRESS_SCRIPTS', true);
define('COMPRESS_CSS', true);
define('EMPTY_TRASH_DAYS', 7);
define('WP_POST_REVISIONS', 5);
```

---

## Next Steps

Now that installation is complete:

1. ✅ [Getting Started Guide](getting-started.md) - Learn the basics
2. ✅ [Managing Languages](managing-languages.md) - Add and configure languages
3. ✅ [Translating Content](translating-content.md) - Create your first translations
4. ✅ [Performance Tuning](../guides/performance-tuning.md) - Optimize for speed

---

## Support

### Need Help?

- **Documentation**: [docs.press.zone](https://docs.press.zone)
- **Video Tutorials**: [press.zone/videos](https://press.zone/videos)
- **Community Forum**: [forum.press.zone](https://forum.press.zone)
- **Email Support**: support@press.zone
- **Enterprise Support**: enterprise@press.zone (24/7)

### Report Issues

Found a bug? [Submit an issue](https://github.com/presszone/multilingual-press-zone/issues)

---

**Installation complete! You're ready to make your WordPress site multilingual.**
