user2884242
user2884242

Reputation:

php - Creating the PHP source code unreadable

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

Upvotes: 1

Views: 6662

Answers (2)

Serge Seredenko
Serge Seredenko

Reputation: 3541

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

Upvotes: 1

Fleshgrinder
Fleshgrinder

Reputation: 16253

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.

Upvotes: 4

Related Questions