-
Setting up OCI8 (PHP Oracle module) on Webfaction
Webfaction, my favorite web host, allows you to compile PHP modules in your home directory for use on your websites. Here’s the process for configuring OCI8 to talk to Oracle databases:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748# Make directoriesmkdir -p ~/lib/php71_exts/mkdir -p ~/lib/php71_exts/instantclientcd ~/lib/php71_exts# Get the php modulewget https://pecl.php.net/get/oci8-2.1.8.tgztar xvf oci8-2.1.8.tgzcd oci8-2.1.8phpize71# Get Oracle Instant Client (use your local computer)# http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html# SSH the files to the serverscp instantclient*.zip web553:~/lib/php71_exts/# Extract files and symlink a few modulesmv instantclient*.zip instantclient/cd instantclient/unzip instantclient-basic-linux.x64-12.2.0.1.0.zipunzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zipunzip instantclient-sdk-linux.x64-12.2.0.1.0.zipcd instantclient_12_2/ln -s libclntsh.so.12.1 libclntsh.soln -s libocci.so.12.1 libocci.so# Configure the php modulecd ~/lib/php71_exts/oci8-2.1.8/./configure --with-oci8=shared,instantclient,/home/yourname/lib/php71_exts/instantclient/instantclient_12_2 -with-php-config=/usr/local/bin/php71-configmakemv modules/oci8.so ~/lib/php71_exts/# Enable the modulecd ~/webapps/mysitels /home/yourname/lib/php71_exts/oci8.sols -alh /home/yourname/lib/php71_exts/oci8.sovim php.iniextension_dir=/home/yourname/lib/php71_extsextension=/home/yourname/lib/php71_exts/oci8.so# Test# Create a file (e.g., index.php) to call phpinfo().# Load the page and check if the OCI module is loaded.# Cleanupcd ~/lib/php71_exts/rm package.xml oci8-2.1.8.tgz