Cyril Joudieh
Cyril Joudieh

Reputation: 124

Protect PHP source code

due to bad internet bandwidth in my country, the client wishes for me to install my PHP/MySQL application on his Windows server or a Linux server.

What is the best way to protect the source code? Or the folder where the PHP source code resides. The client should be able to use the rest of the server freely.

Thank you. Cyril

Upvotes: 1

Views: 3060

Answers (4)

muratGursel
muratGursel

Reputation: 151

You can obfuscate the php code online obfuscator/encoder like this This tool protects code with powerful techniques, easier to rewrite than decode.

Upvotes: 1

user3459148
user3459148

Reputation: 19

You can obfuscate the php files on the server for extra protection. Obfuscation makes it more difficult for an attacker to understand your code, if he eventually gets in. Remember to keep an un-obfuscated back-up of your files.

Check Out Zend Guard

Upvotes: 0

BenBornschein
BenBornschein

Reputation: 91

The best way to protect your php code is imho http://www.ioncube.com/

I would not recommend Zend Guard, because some tools exists which can recompile (not perfect) the compiled php code.

PHP Encode is also a bad idea, because it slows down your php code way more than other encoder.

Upvotes: 1

WhiteLine
WhiteLine

Reputation: 1991

you could use a code obfuscator

this is an example

though (with great difficulty) the code could be re-converted, but at least make the code more difficult to read

example 1

<?php
    echo phpinfo();
?>

would turn into something like this

<?php $XnNhAWEnhoiqwciqpoHH=file(__FILE__);eval(base64_decode("aWYoIWZ1bmN0aW9uX2V4aXN0cygiWWl1bklVWTc2YkJodWhOWUlPOCIpKXtmdW5jdGlvbiBZaXVuSVVZNzZiQmh1aE5ZSU84KCRnLCRiPTApeyRhPWltcGxvZGUoIlxuIiwkZyk7JGQ9YXJyYXkoNjU1LDIzNiw0MCk7aWYoJGI9PTApICRmPXN1YnN0cigkYSwkZFswXSwkZFsxXSk7ZWxzZWlmKCRiPT0xKSAkZj1zdWJzdHIoJGEsJGRbMF0rJGRbMV0sJGRbMl0pO2Vsc2UgJGY9dHJpbShzdWJzdHIoJGEsJGRbMF0rJGRbMV0rJGRbMl0pKTtyZXR1cm4oJGYpO319"));eval(base64_decode(YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH)));eval(ZsldkfhGYU87iyihdfsow(YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH,2),YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH,1)));__halt_compiler();aWYoIWZ1bmN0aW9uX2V4aXN0cygiWnNsZGtmaEdZVTg3aXlpaGRmc293Iikpe2Z1bmN0aW9uIFpzbGRrZmhHWVU4N2l5aWhkZnNvdygkYSwkaCl7aWYoJGg9PXNoYTEoJGEpKXtyZXR1cm4oZ3ppbmZsYXRlKGJhc2U2NF9kZWNvZGUoJGEpKSk7fWVsc2V7ZWNobygiRXJyb3I6IEZpbGUgTW9kaWZpZWQiKTt9fX0=684ec3cc57884cf14d34c372f3ab886384a059a3S03OyFcoyCjIzEvL19C0BgA=

example 2

<?php
for( $i = 1; $i <= 10; $i++ ) {
    echo( '5x'.$i.'='.(string)($i*5)."\n" );
}
?>

would turn into something like this

<?php $XnNhAWEnhoiqwciqpoHH=file(__FILE__);eval(base64_decode("aWYoIWZ1bmN0aW9uX2V4aXN0cygiWWl1bklVWTc2YkJodWhOWUlPOCIpKXtmdW5jdGlvbiBZaXVuSVVZNzZiQmh1aE5ZSU84KCRnLCRiPTApeyRhPWltcGxvZGUoIlxuIiwkZyk7JGQ9YXJyYXkoNjU1LDIzNiw0MCk7aWYoJGI9PTApICRmPXN1YnN0cigkYSwkZFswXSwkZFsxXSk7ZWxzZWlmKCRiPT0xKSAkZj1zdWJzdHIoJGEsJGRbMF0rJGRbMV0sJGRbMl0pO2Vsc2UgJGY9dHJpbShzdWJzdHIoJGEsJGRbMF0rJGRbMV0rJGRbMl0pKTtyZXR1cm4oJGYpO319"));eval(base64_decode(YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH)));eval(ZsldkfhGYU87iyihdfsow(YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH,2),YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH,1)));__halt_compiler();aWYoIWZ1bmN0aW9uX2V4aXN0cygiWnNsZGtmaEdZVTg3aXlpaGRmc293Iikpe2Z1bmN0aW9uIFpzbGRrZmhHWVU4N2l5aWhkZnNvdygkYSwkaCl7aWYoJGg9PXNoYTEoJGEpKXtyZXR1cm4oZ3ppbmZsYXRlKGJhc2U2NF9kZWNvZGUoJGEpKSk7fWVsc2V7ZWNobygiRXJyb3I6IEZpbGUgTW9kaWZpZWQiKTt9fX0=677f209731e728fdbcbec2b1e7f962f8042b6d7aS8sv0lBQyVSwVTC0BtE2QIYBiKWtraCpUM3LlZqcka+hoGRaoaSnkqmnZKukp1FcUpSZl66poZKpZaqppxSTp6Sgac3LVQsA

Upvotes: 3

Related Questions