<?php
/**
 * Chilkat PHP Wrapper - Fixed for servers with dl() disabled
 * This file defines the Chilkat classes
 */

// Check if Chilkat extension is loaded
if (!extension_loaded('chilkat')) {
    // Try to load it only if dl() is available and not in safe mode
    if (function_exists('dl') && !ini_get('safe_mode')) {
        $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
        @dl($prefix . 'chilkat.' . PHP_SHLIB_SUFFIX);
    }
    
    // If still not loaded, show error
    if (!extension_loaded('chilkat')) {
        die("ERROR: Chilkat extension is not loaded.\n" .
            "Please contact your hosting provider to enable the Chilkat extension,\n" .
            "or add 'extension=chilkat.so' to your php.ini file.\n");
    }
}

// Verify classes are available
if (!class_exists('CkGlobal')) {
    die("ERROR: Chilkat extension is loaded but classes are not available.\n" .
        "This may indicate a version mismatch or corrupted installation.\n");
}

// All good - Chilkat is ready
// Classes like CkGlobal, CkXml, CkCert, etc. are now available
?>