How to Install the Chilkat PHP Extension on Linux/Solaris

1. Download

Chilkat PHP Downloads

The download contains the following files:

	license.txt
	README.txt
	phpinfo.php
	showExtDir.php
	test.php
	chilkat_9_5_0.php
	chilkat_9_5_0.so

2. Decompress and Extract to any Directory

gzip -dc chilkatPhp-9.5.0-x86_64-linux.tar.gz | tar -xof -

3. Copy chilkat_9_5_0.so to the PHP extensions directory.

To find the path of the PHP extensions directory, run the showExtDir.php script:

php showExtDir.php

(Alternatively, use the php5 command if necessary. Some systems may have both php and php5 each of which is a different version of PHP.

php5 showExtDir.php

A typical extension directory path is /usr/lib/php5/20131226

It may be that the extensions directory does not yet exist. If so, create the directories. Make sure to use your PHP extensions directory, which may or may not be the same as what is shown here:

sudo mkdir /usr/local/lib/php/extensions
sudo mkdir /usr/lib/php5/20131226

Now that the extensions directory exists, copy the chilkat shared library to it:

sudo cp chilkat_9_5_0.so /usr/lib/php5/20131226

4. Edit php.ini to Automatically Load the Chilkat Extension

* See the notes below for more explicit instructions for Mac OS X.

Locate the php.ini configuration file for your PHP installation. The location of the php.ini depends on where PHP was installed, and apparently there is no standard way to find it (even though PHP has an install base of millions and the need to edit php.ini is quite common). The phpinfo function lists the location of the php.ini, but in many cases it provides incorrect information.

<?php 
    phpinfo();
?>

If phpinfo provides incorrect information, php.ini might be found in one of the following directories:

/etc/php.ini
/etc/php/php.ini
/etc/php5/php.ini
/etc/php5/cli/php.ini
/usr/bin/php/php.ini
/usr/bin/php5/bin/php.ini
/etc/php5/apache2/php.ini

If still not found, start a terminal and type this "find" command at the shell prompt:

find / -name php.ini 2> /dev/null

(It is likely you'll need to be root to edit the php.ini.)
Open the php.ini and locate the "Dynamic Extensions" section. Add the following line:

extension=chilkat_9_5_0.so

5. Run test.php to Verify

Run the test.php script to verify that the Chilkat extension is properly installed:

php test.php

The test.php script encrypts and decrypts a string. If successful, the output will look like this:

SEb4OqIR4jmqYqIfUn8Inundvq0w7hXU55tgemIbl77bm28AqbIfG0OlC0wb4O3y
The quick brown fox jumps over the lazy dog.

6. Use Chilkat in your PHP Scripts

To use Chilkat in your PHP scripts, include "chilkat_9_5_0.php" like this:

<?php

include("chilkat_9_5_0.php");

...

?>

7. Special Notes for Editing php.ini on Mac OS X

On Mac OS X, the php.ini is located in the /etc directory. If there is no php.ini file, then you need to make one from php.ini.default in the same location like so:

sudo cp /etc/php.ini.default /etc/php.ini
sudo chmod u+w  /etc/php.ini
Then add the line in your preferred text editor:
sudo nano /etc/php.ini
or
sudo vi /etc/php.ini