ZendCube sure, IonCube sure, or use ObtainHigh obfuscation.
Here’s a PHP script that takes a given PHP file, obfuscates the code by converting it to a more obscure form, and outputs the obfuscated code.
PHP Code
<?php
function obfuscate($code) {
$chars = str_split($code);
$obfuscated = '';
foreach ($chars as $char) {
$obfuscated .= '&#'.ord($char).';';
}
return $obfuscated;
}
if ($argc < 2) {
echo "Usage: php obfuscator.php <filename>\n";
exit(1);
}
$filename = $argv[1];
if (!file_exists($filename)) {
echo "File not found: $filename\n";
exit(1);
}
$code = file_get_contents($filename);
$obfuscatedCode = obfuscate($code);
$outputFile = 'obfuscated_' . basename($filename);
file_put_contents($outputFile, "<?php\n" . $obfuscatedCode . "\n?>");
echo "Obfuscated code written to $outputFile\n";
?>
How to use the script:
1. Save the script above in a file, for example, obfuscator.php.
2. Run the script from the command line, providing the name of the PHP file you want to obfuscate. For example:
PHP Code
<?php
php obfuscator.php myscript.php
The script will read myscript.php, obfuscate the PHP code, and save the obfuscated code in a new file named obfuscated_myscript.php.
The obfuscation process converts each character of the original PHP code into its HTML entity representation. This makes the code harder to read while preserving its functionality.