Free PHP Obfuscator

Update: The obfuscator download is not active anymore.

You may need to obfuscate your php code for security or licensing reasons. So the other third party cannot easily hijack your code for their own reasons. Obfuscated code is source or machine code that has been made difficult to understand for humans. So if you planning to sell your php script, make sure you obfuscated it for security and license reasons.

There are a lot of tools to obfuscating PHP script, 2 best tools on the net right now is IonCube Encoder and Zend Guard. But unfortunately they are not free, and you need to install IonCube loader or Zend Guard loader module on the server, so the obfuscated could read properly.

If you are developing small PHP project than i suggest you to use the free PHP Obfuscator instead using IonCube Encoder or Zend Guard. You can use PHP Obfuscator from Raizlabs, it is light and free. I love free software, and i bet you do too 🙂

Screenshot:

Here is the sample:

getbrowser.php

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
function getBrowser()
{
    $u_agent = $_SERVER['HTTP_USER_AGENT'];
    $bname = 'Unknown';
    $platform = 'Unknown';
    $version= "";
 
    //First get the platform?
    if (preg_match('/linux/i', $u_agent)) {
        $platform = 'linux';
    }
    elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
        $platform = 'mac';
    }
    elseif (preg_match('/windows|win32/i', $u_agent)) {
        $platform = 'windows';
    }
 
    // Next get the name of the useragent yes seperately and for good reason
    if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
    {
        $bname = 'Internet Explorer';
        $ub = "MSIE";
    }
    elseif(preg_match('/Firefox/i',$u_agent))
    {
        $bname = 'Mozilla Firefox';
        $ub = "Firefox";
    }
    elseif(preg_match('/Chrome/i',$u_agent))
    {
        $bname = 'Google Chrome';
        $ub = "Chrome";
    }
    elseif(preg_match('/Safari/i',$u_agent))
    {
        $bname = 'Apple Safari';
        $ub = "Safari";
    }
    elseif(preg_match('/Opera/i',$u_agent))
    {
        $bname = 'Opera';
        $ub = "Opera";
    }
    elseif(preg_match('/Netscape/i',$u_agent))
    {
        $bname = 'Netscape';
        $ub = "Netscape";
    }
 
    // finally get the correct version number
    $known = array('Version', $ub, 'other');
    $pattern = '#(?<browser>' . join('|', $known) .
    ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
    if (!preg_match_all($pattern, $u_agent, $matches)) {
        // we have no matching number just continue
    }
 
    // see how many we have
    $i = count($matches['browser']);
    if ($i != 1) {
        //we will have two since we are not using 'other' argument yet
        //see if version is before or after the name
        if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
            $version= $matches['version'][0];
        }
        else {
            $version= $matches['version'][1];
        }
    }
    else {
        $version= $matches['version'][0];
    }
 
    // check if we have a number
    if ($version==null || $version=="") {$version="?";}
 
    return array(
        'userAgent' => $u_agent,
        'name'      => $bname,
        'version'   => $version,
        'platform'  => $platform,
        'pattern'    => $pattern
    );
}
 
// now try it
$ua=getBrowser();
$yourbrowser= "Your browser: " . $ua['name'] . " " . $ua['version'] . " on " .$ua['platform'] . " reports: <br >" . $ua['userAgent'];
print_r($yourbrowser);
var_dump($ua);

Obfuscated code:

01
02
03
04
05
06
07
08
09
10
/* This file encoded by Raizlabs PHP Obfuscator http://www.raizlabs.com/software */
function FCFA1126BBD6006F3F3CA454ED1DF2781() {     $RD3EDD54BF7F748F7C341993E5E16FBE4 = $_SERVER['HTTP_USER_AGENT'];     $R936F519EB526FBE7AD6FFC1C022A0202 = 'Unknown';     $RF35DD214BA0E512C4E40F4936F263F63 = 'Unknown';     $RC4B8AB500089B24B2D72685C7B9F7AC0= "";      //First get the platform?
if (preg_match('/linux/i', $RD3EDD54BF7F748F7C341993E5E16FBE4)) {         $RF35DD214BA0E512C4E40F4936F263F63 = 'linux';     }     elseif (preg_match('/macintosh|mac os x/i', $RD3EDD54BF7F748F7C341993E5E16FBE4)) {         $RF35DD214BA0E512C4E40F4936F263F63 = 'mac';     }     elseif (preg_match('/windows|win32/i', $RD3EDD54BF7F748F7C341993E5E16FBE4)) {         $RF35DD214BA0E512C4E40F4936F263F63 = 'windows';     }         // Next get the name of the useragent yes seperately and for good reason
if(preg_match('/MSIE/i',$RD3EDD54BF7F748F7C341993E5E16FBE4) && !preg_match('/Opera/i',$RD3EDD54BF7F748F7C341993E5E16FBE4))     {         $R936F519EB526FBE7AD6FFC1C022A0202 = 'Internet Explorer';         $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7 = "MSIE";     }     elseif(preg_match('/Firefox/i',$RD3EDD54BF7F748F7C341993E5E16FBE4))     {         $R936F519EB526FBE7AD6FFC1C022A0202 = 'Mozilla Firefox';         $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7 = "Firefox";     }     elseif(preg_match('/Chrome/i',$RD3EDD54BF7F748F7C341993E5E16FBE4))     {         $R936F519EB526FBE7AD6FFC1C022A0202 = 'Google Chrome';         $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7 = "Chrome";     }     elseif(preg_match('/Safari/i',$RD3EDD54BF7F748F7C341993E5E16FBE4))     {         $R936F519EB526FBE7AD6FFC1C022A0202 = 'Apple Safari';         $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7 = "Safari";     }     elseif(preg_match('/Opera/i',$RD3EDD54BF7F748F7C341993E5E16FBE4))     {         $R936F519EB526FBE7AD6FFC1C022A0202 = 'Opera';         $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7 = "Opera";     }     elseif(preg_match('/Netscape/i',$RD3EDD54BF7F748F7C341993E5E16FBE4))     {         $R936F519EB526FBE7AD6FFC1C022A0202 = 'Netscape';         $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7 = "Netscape";     }         // finally get the correct version number
$RE9C4E610341A88DB0846498C2C422A2D = array('Version', $R6EC2C3E4F1A67ECC8AD64C6F8873B4B7, 'other');     $R1DD288014A4DB47D1D475344526959BE = '#(?<browser>' . join('|', $RE9C4E610341A88DB0846498C2C422A2D) .     ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';     if (!preg_match_all($R1DD288014A4DB47D1D475344526959BE, $RD3EDD54BF7F748F7C341993E5E16FBE4, $R2BC3A0F3554F7C295CD3CC4A57492121)) {         // we have no matching number just continue
}         // see how many we have
$RA16D2280393CE6A2A5428A4A8D09E354 = count($R2BC3A0F3554F7C295CD3CC4A57492121['browser']);     if ($RA16D2280393CE6A2A5428A4A8D09E354 != 1) {         //we will have two since we are not using 'other' argument yet         //see if version is before or after the name
if (strripos($RD3EDD54BF7F748F7C341993E5E16FBE4,"Version") < strripos($RD3EDD54BF7F748F7C341993E5E16FBE4,$R6EC2C3E4F1A67ECC8AD64C6F8873B4B7)){             $RC4B8AB500089B24B2D72685C7B9F7AC0= $R2BC3A0F3554F7C295CD3CC4A57492121['version'][0];         }         else {             $RC4B8AB500089B24B2D72685C7B9F7AC0= $R2BC3A0F3554F7C295CD3CC4A57492121['version'][1];         }     }     else {         $RC4B8AB500089B24B2D72685C7B9F7AC0= $R2BC3A0F3554F7C295CD3CC4A57492121['version'][0];     }         // check if we have a number
if ($RC4B8AB500089B24B2D72685C7B9F7AC0==null || $RC4B8AB500089B24B2D72685C7B9F7AC0=="") {$RC4B8AB500089B24B2D72685C7B9F7AC0="?";}         return array(         'userAgent' => $RD3EDD54BF7F748F7C341993E5E16FBE4,         'name'      => $R936F519EB526FBE7AD6FFC1C022A0202,         'version'   => $RC4B8AB500089B24B2D72685C7B9F7AC0,         'platform'  => $RF35DD214BA0E512C4E40F4936F263F63,         'pattern'    => $R1DD288014A4DB47D1D475344526959BE     ); }  // now try it
$RE63F6556DE280F4131E2A6E2926023BE=FCFA1126BBD6006F3F3CA454ED1DF2781(); $R642BF308CE21E5227B53E275079F34C5= "Your browser: " . $RE63F6556DE280F4131E2A6E2926023BE['name'] . " " . $RE63F6556DE280F4131E2A6E2926023BE['version'] . " on " .$RE63F6556DE280F4131E2A6E2926023BE['platform'] . " reports: <br >" . $RE63F6556DE280F4131E2A6E2926023BE['userAgent']; print_r($R642BF308CE21E5227B53E275079F34C5); var_dump($RE63F6556DE280F4131E2A6E2926023BE);

See the result example here:
getbrowser.php
getbrowser-obfuscated.php

Download Raizlabs PHP Obfuscator

Comments

  1. Soundararajan C says:

    Download link is redirecting to https://www.raizlabs.com/work/

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.