Skip to content Skip to sidebar Skip to footer

Install and Encode the .php file with php version 8.0 using sourceguardian on RHEL 8

Hi everyone, on this occasion I will share how to endcode .php files using sourceguardian. Do you know what encoding is? Yes, encrypt a file so that it is difficult for humans to read, our code is safer even though it has been taken by unauthorized parties.

Before we encode the file, of course, we need sourceguardian itself, you can download it on the website directly, visit the website at

Well, the software is paid, you can buy it if you have tried and are interested, here I also use the trial version.

You can register with your personal data, then you will be sent an email from sourceguardian containing the user login, after logging in you will be presented with some sourceguardian software that is compatible with several OS. Since I use linux I downloaded sourceguardian for Linux OS.


Download Sourceguardian 

Visit sourceguardian Site – Login – Download

Download Sourceguardian
Download Sourceguardian

Upload to Server

Upload the downloaded sourceguardian to the server.

Upload Sourceguardian to Server
Upload Sourceguardian to Server


Extract Sourceguardian 

Once uploaded, you can extract the file. 

$ tar -xzvf SourceGuardian-12.1-Evaluation-Linux-x86_64-CLI.tar.gz
$ cd /home/kitsake/sourceguardian-evaluation/bin/


Because we are using a trial, you have to read the FAQ from sourceguardian and input your email and sourceguardian account password, then you can use sourceguardian.

FAQ of Sourceguardian
FAQ of Sourceguardian


For use, it's quite easy, all you have to do is hit the sourceguardian service and the files will be encrypted.
$ ./sourceguardian /home/kitsake/sourcecode/source/phpinfo.php
simple use of sourceguardian
simple use of sourceguardian
Because it's impossible for us to have an application that only has 1 file, 2 files or several that can be counted on the fingers, there must be a file with the .php extension that will be encrypted. Here I have made the sourceguardian command and the desired options. So 1 folder and its contents containing the .php file will be encrypted.
$ ./sourceguardian --phpversion 8.0 --strict-errors --keep-file-date -b- -r -f "*.php" "/home/kitsake/kitsake/sourcecode/source/" -o "/home/kitsake/destination/"
Custom Usage
Custom Usage

Now for the options you can see for yourself by:

$ ./sourceguardian --help

Or you can see below: 

SourceGuardian 12.1.1 Encoder Evaluation (built: Aug 12 2021 04:48:06)
Copyright (c) 2000-2021 SourceGuardian Ltd.
Supports encoding for PHP versions: 4.3,4.4,5.0,5.1,5.2,5.3,5.4,5.5,5.6,7.0,7.1,7.2,7.3,7.4,8.0

Usage, single file: sourceguardian [options] file.php
multiple files: sourceguardian [options] file1.php file2.php file3.php
file mask: sourceguardian [options] "*.php" "/path/to/*.php"
file list: sourceguardian [options] @filelist


--phpversion <version x.y> Encode for PHP version
* --expire <dd/mm/yyyy> Set script expiration date
* --expire <00d[00h[00m[00s]]]> Set script expiration time from now
* --domain <domain> Bind script to domain name
* --domain-encrypt <domain> Bind and encrypt to domain name (one only)
* --ip <x.x.x.x[/y.y.y.y]> Bind script to ip/mask
* --ip-encrypt <x.x.x.x[/y.y.y.y]> Bind and encrypt to ip/mask (one only)
* --mac <xx:xx:xx:xx:xx:xx> Bind script to mac address
* --machine-id <machine id> Bind script to a machine id (read manual)
* --machine-id-encrypt <machine id> Bind and encrypt to a machine id (read manual)
* --remote-verification-url <URL> URL for remote machine id verification for CLI (read manual)
* --external <filename> Script will require license file to run
* --conj Work only with other encoded files
* --projid <value> Set project id (required for ext license)
* --projkey <value> Set project key (required for ext license)
* --time-server <server,server,...> Set time server (for expiration date check)
* script locking options are disabled for evaluation version

--const name=value Set custom defined constant
--catch err=function Set custom error handler
--auto-global name Add a custom auto-global variable (PHP5+)

--asp-tags Enable the use of ASP-like <% %> tags
--no-short-tags Disable the use of short PHP's <? ?> tags
-p "code"|@file Prepend header code
-j "code"|@file Change default loader error code
-n Do not integrate dynamic loader code
-z<0-9> Compression method (0-fastest..9-maximum)
--eval-compatible eval() compatibility mode for encoded files (read manual)
--stop-on-error Stop on script compiling error
--strict-errors Report E_STRICT compiling errors
--deprec-errors Report E_DEPRECATED PHP 5.3+ compiling errors
--keep-file-date Keep modification date for encoded files
--keep-doc-comments Keep doc comments within encoded files (removed by default)
-b <ext> Set file extension for backup files (bak is default)
-b- Disable backup of source files (THINK TWICE)
-r{n} Recurse (optionally strip {n} directories from the target path)
-x "mask"|@list Exclude files from processing (don't encode or copy)
-f "mask"|@list Encode these files as PHP code
-t "mask"|@list Encode these files as custom non-PHP ones (read manual)
-c "mask"|@list Copy files without encoding (use with -o)
-o <output_dir> Specify the output directory for encoded files
-a <YYYYMMDDhhmmss> Only encode files newer than the specified date/time
--ignore-symlinks Ignore symlinks while recursively scanning directories
-w Wait for key press before exit
-q Display settings and request confirmation
-v Display version number
--verbose <value> 0-quiet, 1-only errors, 2-encoding log (default)
--docker-socket <> Path to the mapped docker socket for installing to a Docker container
--license-file <> Path to the license file
--license-release Release the license for this installation
--license Display license information
-h Display this help

Yes, that's it for those of you who don't know how to encrypt or are interested in this sourceguardian software, by looking at this article, hopefully you will get enlightenment.

That is all and thank you.

Bangkit Ade Saputra
Bangkit Ade Saputra Hard-working professional with experience and a proven knowledge of operating system, server architecture and system configuration.

Post a Comment for "Install and Encode the .php file with php version 8.0 using sourceguardian on RHEL 8"