GoAdmio

encoder

Encode a domain's PHP source files so they run only through GoAdmio's installed decoder

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/encoder replaces the contents of .php and .inc files with an encrypted blob and a small loader, so the original source is no longer readable on disk. The files still run normally, because GoAdmio's decoder.so extension decrypts them at request time (PHP 8 or higher). This is meant for distributing PHP code without exposing its source, not as a security boundary: anyone who can run PHP on the server can still make it echo its own decoded source.

[!WARNING] This replaces the file in place. There is no built-in way to recover the original source from an encoded file. Keep your own copy of the source before running this.

The call is appended to /var/log/go/encoder.log.


Quick start

# Encode one account's www folder, after backing up the source elsewhere
/go/encoder example.com

Syntax

/go/encoder <domain>
/go/encoder <path>
/go/encoder all
/go/encoder <domain-or-path> <skip>[,<skip>...]
Form Behavior
/go/encoder <domain> Encodes every .php and .inc file under /home/<domain>/www.
/go/encoder <path> Encodes every .php and .inc file under that file or folder. Works for any path that exists, including one containing /www/.
/go/encoder all Encodes every .php and .inc file under /home — every hosted account.
/go/encoder <target> <skip> Same, but leaves out files matching <skip>. Several patterns can be comma-separated.

With no arguments it prints Domain name does not exist but does not stop, then fails the next check and exits.


Options

Argument Required Notes
<domain> or <path> Yes A hosted domain, all, or any file or folder path on the server.
<skip> No A plain substring matched against each file's full path, not a glob or regex. Slashes are escaped automatically. Comma-separate several patterns.

Output

Encoder: /home/example.com/www
[1/42] Encoding /home/example.com/www/config.php...
[2/42] Encoding /home/example.com/www/index.php...
Error: <?php not closed in file /home/example.com/www/broken.php
Message Meaning
Domain name does not exist No arguments were given. The command does not stop here (see Troubleshooting).
<value> does not exist The path or domain couldn't be found. The command stops.
[n/total] Encoding <file>... That file was encoded.
Error: <?php not closed in file <file> The file's <?php and ?> tag counts don't match. Left unchanged.

A file is skipped with no message when it already contains decoder::Code (already encoded), contains the text skip encoder, matches a <skip> pattern, or has no <?php tag at all.


Examples

# One account
/go/encoder example.com
# One file
/go/encoder /home/example.com/www/config.php
# Every account on the server
/go/encoder all
# One account, leaving out the uploads folder
/go/encoder example.com /home/example.com/www/wp-content/uploads
# One account, leaving out two folders
/go/encoder example.com "wp-content/uploads,vendor"
# Mark a file to never be encoded
echo "// skip encoder" >> /home/example.com/www/license.php

Troubleshooting

Symptom Likely cause Fix
No output and exit status 0 No arguments were given. The initial check doesn't stop the script; it later fails the path check too, silently. Pass a domain or path.
Error: <?php not closed in file <file> The file has a different number of <?php than ?> tags, often because ?> appears in a string or a template file. Fix or exclude the file.
A file with valid PHP wasn't touched It already contains decoder::Code, contains the text skip encoder anywhere in it, or matched a <skip> pattern. Expected if intentional. Otherwise check the file for that text.
The site shows a blank page or a decoder error after encoding decoder.so isn't installed or isn't loaded for the PHP version in use, or the file was already corrupted before encoding. Check the PHP error log and that decoder.so is enabled for that PHP version.
A --skip pattern with special characters doesn't match Patterns are inserted into a sed delete command; characters such as . or * are treated as part of a regex. Use a plain substring without special characters, or escape them yourself.
Encoding breaks a file that mixes HTML and PHP The loader replaces the entire file with pure PHP. Any HTML that lived outside the original <?php ... ?> tags is lost from the output. Don't encode templates that rely on surrounding HTML; keep logic and templates in separate files.

Details

Selecting files

The command builds a list of every .php and .inc file under the target with find, saved to /usr/local/goadmio/tmp/encoder.db, then removes any line containing a space (a filename with a space in it is silently dropped from the run) and any line matching a <skip> pattern.

Per-file checks

A file is encoded only if, in order:

  1. It does not already contain decoder::Code (already encoded).
  2. It does not contain the text skip encoder anywhere in it.
  3. It contains <?php somewhere in it.
  4. Its count of <?php equals its count of ?>.

What gets written

The whole file is replaced with:

<?php
// Go Encoder v3 Powered by www.goadmio.com
$Code="<encrypted-base64>";
echo Decoder\decoder::Code("$Code","<key>");
?>

The encoding format is internal to GoAdmio and not documented here.

Known issues


See also

Command Description
ioncube Install IonCube Loader on a GoAdmio server
findbom Find BOM (byte order mark) in PHP files
removebom Remove BOM from all PHP files in GoAdmio
scan Scan newly modified PHP files for shells and the root password
backup Back up one or all accounts to local disk or remote storage, manually or on a schedule