1

I have a PHP web application, I want to make code unreadable. I have googled and the way I got is obfuscate. But the thing I want to know that making it unreadable will create any performance problem? If yes than is there is any way to make the code unreadable without affecting the performance?

Thanks

6
  • 1
    Why would you want to do this? If you don't want others to read the code, then perhaps don't publish it? Commented Oct 15, 2013 at 21:39
  • 1
    Your title says you want the PHP code unreadable - but users cannot actually see the source code, just the output. Do you want to make the HTML/JS etc difficult to read, or do you in fact mean you want to make the PHP unreadable? Commented Oct 15, 2013 at 21:41
  • Before supplying the code anywhere, I want to do it. Commented Oct 15, 2013 at 21:42
  • @Fluffeh Yes I want to make PHP code unreadable, not the HTML or JS code. Commented Oct 15, 2013 at 21:43
  • 2
    @PrateekSinha I am pretty sure that Zend has something that makes the code unreadable, not sure what other gimicks are involved with it. Be aware though, if I paid someone for code and they handed be code that was unreadable, meaning that none of my own support staff could troubleshoot it, I wouldn't pay a dime for it. Commented Oct 15, 2013 at 21:46

2 Answers 2

4

The first question is, why would you want to do that? A PHP application is usually hosted on a server that belongs to you and you should protect your files against the outside world via proper configuration of your server and against local users via proper permissions.

Your question regarding obfuscation and performance is hard to answer, because we don't know how the obfuscation looks like. If it's something like base64 encoding everything and then running things through eval(), well yeah, that will definitely result in a performance hit.

If you'd really want to make it unreadable and inaccessible use APC or OPcache. Set the TTL to 0 and delete all files. Your website is delivered only from the cached files. Of course as soon as you restart PHP/APC/OPcache/the server you'd have to upload everything again, execute each script to fill the cache again and delete everything.

You could also use some program that morphs your PHP to C++ code and compiles it. But you'd have the same situation as with the cache idea.

No matter what you do, you are definitely doing something wrong. Source code is not meant to be unreadable (beside JavaScript, but that's always a different story). On the contrary, it should be well designed, good documented and easily readable.

Sign up to request clarification or add additional context in comments.

1 Comment

How about hosting php application written by you on the server of someone else just because the client wants this wa?
1

You could translate your php code to bytecode. You will make it absolutely unreadable and boost performance. Here you got some options for that.

1 Comment

And delete the source afterwards. ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.