Installing php loaders

From DreamHost

Jump to: navigation, search

Contents

Disclaimer

The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.
Server changes may cause this to break. Be prepared to troubleshoot this yourself if this happens.
We seriously aren't kidding about this.

What is a php loader

PHP loaders are programs that load special php files. They include such pieces of software as

  • Zend_Loader
  • ZendOptimizer
  • PHPShield
  • ionCube

The purpose of all of these pieces of software, with the exception of ZendOptimizer, is to allow the creators of php software some level of copy protection, so all their thieving would-be customers don't just trade copies of their scripts.

It's not too terribly difficult to get a PHP Loader working.


Getting Started

The first thing that needs to be done before you can use a php loader, is you must install a custom php.ini file. There are extensive instructions already, which can be found Custom_PHP.ini

Just follow these instruction through exactly. If you are using php5, then you need to use the name php5.cgi every time that wiki article says php.cgi.


Check that PHP.ini is working correctly

You should really check and make sure that your php.ini file is working correctly before proceeding. Make a script called phpinfo.php with the following contents, and upload it to your site.

  • Source of phpinfo.php
<?php phpinfo(); ?>

Simple enough. When you view this file through a browser you'll see a whole page of information on php. Scroll down to Loaded Configuration File - it should have the path of your home directory, not /etc/php.


ZendOptimizer and ZendLoader

These are installed on Dreamhost servers by default. You should not have to do anything additional to install them.


ionCube

First, use the phpinfo.php script to figure out what version of php you are using. It'll either be php 5.2 or php 4.4.

Go to your custom php.ini file. At the very bottom, add the line

  • PHP 5.2
zend_extension="/home/YOUR_USER/YOUR_SITE/ioncube/ioncube_loader_lin_5.2.so"
  • PHP 4.4
zend_extension="/home/YOUR_USER/YOUR_SITE/ioncube/ioncube_loader_lin_4.4.so"


Once you have done that, go slightly up, and find the two other zend_extension statements. These are for ZendOptimizer. Comment them out so that it looks like

  • Zend stuff begone
#zend_extension="/usr/local/dh/apache/template/phpext/ZendExtensionManager.so"
#zend_extension="/usr/local/dh/apache/template/phpext/zend_optimizer5/ZendOptimizer.so"

If you get an Internal service error than you most likely did not comment out the Zend stuff. Note that contrary to ioncube's instructions, the web server does not need to be restarted.


A great alternative is the ionCube script provided on [1]. It does everything described above in this section. If you use the phpini script from the same forum, first run that script and afterwards the ionCube script.

PHPShield

Installing PHPShield is similar to installing ionCube. Their instructions can be found here

Find a line in your php.ini labeled enable_dl. It should look like

  • Enable_dl
enable_dl=On

It should be on already, but you need to check. Then find a line that says extension_dir


  • Extension_dir
extension_dir="/home/YOUR_USER/YOUR_SITE/"


It might work at this point, but for the sake of completeness add the following to the end of php.ini

  • PHP 5
extension=phpshield/phpshield.5.2.lin
  • PHP 4
extension=phpshield/phpshield.4.4ts.lin

The phpshield directory must be a subdirectory of the extension_dir!

The phpSHIELD loader can be downloaded from [2]. Depending on what server you are on, you will need either the Linux or the Linux 64-bit version. You can find out which one by entering the following command in a shell:

 uname -m

If this prints "i386", you need the Linux version; if it prints "x86_64", you will need the 64-bit Linux version.

At this point, your phpSHIELD/ionCube protected scripts should work. Woot. A way that you can check if it's loaded is to load phpinfo.php in your browser again. At the very bottom of that page you'll see something like:

Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with the ionCube PHP Loader v3.1.32, Copyright (c) 2002-2007, by ionCube Ltd.

This will tell you if the extension has been loaded correctly without using any ioncube encoded scripts. phpSHIELD should leave a similar message.

Personal tools