Installing the Chilkat PHP Extension on Windows

Step-by-step instructions for adding the Chilkat extension to a Windows PHP installation, plus the checks that prevent the most common “unable to load” errors.

The download must match your PHP build on three points A PHP extension DLL only loads into a PHP that matches it exactly:
  • PHP version — e.g. the 8.5 extension for PHP 8.5.
  • Architecturex64 for 64-bit PHP, win32 for 32-bit PHP.
  • Thread safety — the NTS (non-thread-safe) download for non-thread-safe PHP, or the regular (thread-safe) download for thread-safe PHP.
Step 3 shows how to read all three from your PHP.
  1. Download

    Get the build for your PHP from the Chilkat Windows PHP Downloads.

  2. What's in the download

    Unzip the .zip (with 7-Zip or Windows Explorer). It contains:

    chilkat-php-<version>-<build>/
    ├─ chilkat.php             PHP class definitions (include this)
    ├─ chilkat.dll             the Chilkat extension
    ├─ phpinfo.php             prints your PHP configuration
    ├─ showExtDir.php          prints the extension directory
    ├─ test.php                verifies the install
    ├─ license.pdf
    ├─ pcre2-license.pdf
    └─ quickjs-license.pdf
    Two files, two roles: chilkat.dll is the native extension that PHP loads (Steps 4–5). chilkat.php defines the Chilkat classes (CkGlobal, CkHttp, …) and is included by your own scripts — keep it where your script can find it (your project directory or a path on include_path).
  3. Check your PHP version, architecture, and thread safety

    From a command prompt:

    php -v
    php -i | findstr /C:"Thread Safety" /C:"Architecture" /C:"Loaded Configuration File" /C:"extension_dir"

    Or run phpinfo.php through your web server to see the values that apply to web requests (these can differ from the command-line PHP):

    • Thread Safetydisabled = use the NTS download; enabled = use the regular download.
    • Architecturex64 = x64 download; x86 = win32 download.
    • Loaded Configuration File → the php.ini you'll edit in Step 6.
    • extension_dir → where chilkat.dll goes in Step 4.
  4. Copy chilkat.dll to the extension directory

    Copy chilkat.dll into PHP's extension directory. To find it, run:

    php showExtDir.php

    (showExtDir.php simply prints ini_get("extension_dir").) chilkat.php is not an extension — it's the class file your scripts include (Step 7), so keep it with your project or on the include_path.

  5. Enable the extension in php.ini

    Open the php.ini reported as the Loaded Configuration File in Step 3, find the Dynamic Extensions section, and add:

    extension=chilkat.dll

    If you run PHP under Apache, IIS, or PHP-FPM, restart the web server after editing php.ini so the change takes effect. (The command-line PHP picks it up immediately.)

  6. Verify with test.php

    Run the included test.php, which unlocks Chilkat in trial mode and performs an AES encrypt/decrypt:

    php test.php

    Successful output looks like:

    Unlocked in trial mode.
    4846f83aa211e239aa62a21f527f089ee9ddbead30ee15d4e79b607a621b97bedb9b6f00a9b21f1b43a50b4c1be0edf2
    The quick brown fox jumps over the lazy dog.
  7. Use Chilkat in your scripts

    Include chilkat.php and unlock once at the start of your program (any string starts the 30-day trial; use your license code after purchase):

    <?php
    include("chilkat.php");
    
    $glob = new CkGlobal();
    $glob->UnlockBundle("Anything for 30-day trial");
    
    // ... use any Chilkat class, e.g. new CkHttp(), new CkJsonObject(), ...
    ?>

Common errors

“Unable to load dynamic library 'chilkat.dll'”

Almost always a mismatch between the DLL and your PHP. Re-check Step 3 and confirm all three match: PHP version, architecture (x64 vs win32), and thread safety (NTS vs thread-safe). A wrong architecture often reports “%1 is not a valid Win32 application”.

“Class 'CkGlobal' not found”

Your script didn't include the class definitions. Add include("chilkat.php"); and make sure chilkat.php is reachable from your script (same directory or on the include_path).

Works on the command line but not in the web server (or vice-versa)

CLI and the web SAPI can use different php.ini files. Run phpinfo() in the same context that's failing and use the Loaded Configuration File value to be sure you edited the right one — then restart the web server.

Extension still not loaded

Confirm chilkat.dll is actually in the extension_dir from Step 3, that the extension=chilkat.dll line isn't commented out, and (for a web server) that you restarted it.