Encoding & Advanced Options

Home / FAQs / Encoding & Advanced Options

Encoding & Advanced Options

1. What online time servers may you suggest to use?
We suggest that you add pool.ntp.org to your project settings and this is a default. We highly recommend that you specify two or more time servers for reliability if you use this option. At least one time server must be available when your protected script is run. You may find a list of public time servers here: http://support.ntp.org/bin/view/Servers/WebHome
 

2. Got '....parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' [2] - PHP 4.3 compiler error...'
It seems your code is not compatible with PHP 4. Please turn off encoding for PHP 4 by deselecting the PHP 4 checkbox in your project settings. If you do not need to encode for PHP 4 but encoding for PHP 4 is on by default when you create a new project, you may change default settings in application preferences

3. I'm getting 'unable to execute ./sgencoder: No such file or directory' in Linux
If you get the above error message on Linux but you are pretty sure that permissions are correct and the execution bit is set, this error is caused by some missing 32-bit libs on a 64-bit machine. Unfortunately, Linux is not very informative in its error messages in this case. Please install 32-bit compatibility libs. If you use Ubuntu/Debian you may do it by running the following command from console:
 
apt-get install ia32-libs
 
SourceGuardian for Linux is available both as 32-bit or 64-bit application. You may use 32-bit version but need to install the above compatibility libs. Protected files may be run on 32-bit or 64-bit. Installing the above package is required only for running 32-bit version of the encoder on a 64-bit machine. Loaders differ for 32-bit and 64-bit and do not require installing additional packages.

4. Need to encode phar?
If you are using phar and want to encode it or encode some of the files within your phar with SourceGuardian, there are two simple rules to follow:
 
1) Do not encode the entire phar file. Encode files you add to phar.
2) Do not encode a stub script if you use your own or use standard stub.
 

5. How can I change the standard SourceGuardian error message? (Error handling)
With SourceGuardian you may intercept licensing and other errors and also an error regarding a missed loader, if users of your protected code are trying to run it without installing the loader. You may use either a standard PHP error handling mechanism or add a custom error handling function which will catch script licensing and other errors. The latter is preferred. An error handler is a function which accepts two parameters:
 
my_error_handler( $code , $message )
 
Use any name for this function and you may have different functions for different types of errors. The first argument is an error code. The second one contains a default error message. It's important that the error handling functions must be available before the encoded code starts, i.e. all the error handlers must remain unencoded. The best place to add the handler functions is a "custom header", please see Advanced Options in project settings and the code you place to the custom header may look like this (do not forget php tags):
 
 
<?php
if(!function_exists('my_error_handler')){
    function my_error_handler($code, $message) {
?    ?    ??echo sprintf("Custom SourceGuardian general error handler - code=%s", $code);
    }
}
?>
 
Then assign your error handler function to the error condition on the Lock page. Note, you may have different handlers for the error codes or use one code to catch all the errors.
 
 
Finally, encode your project. If you check the encoded file in the editor, you should be able to see the error handler function added to the top of every encoded PHP file. Do not modify the encoded files! If you need to change your error handler, edit it in Custom Header in Advanced Options and then re-encode. Note, we do not check this code for any errors.
 
Please refer to our user manual for further information about error handling. Also you may find in the manual how to use standard PHP mechanism to catch SourceGuardian errors. 
 
Download sample files from our website if you need a sample or if you use a command line encoder, the samples include a shell script with necessary encoding options. 

php encoder Buy Now

 
BUY NOW

Take a Tour!

Check out the features and benefits of SourceGuardian
Find out more
Try our free php source code demo
TRY SOURCEGUARDIAN FREE FOR 14 DAYS
Account Login:

login Forgotten Password?
Connect with us
Bookmark
facebook linkedin twitter rss
© Copyright 2002 - 2024 SourceGuardian Limited
Privacy Policy l Terms & Conditions l Company Info l Contact us l Sitemap l PHP Weekly News