Can we deploy PHP application on a client server and restrict client from viewing or editing any of the code.
For example, if i don't want my client to take the code to some other developers without my permission.
I have looked into PHP code encryption in the past, but it is a fundamentally bad idea.
There are a number of solutions on the market such as Ion Cube and Source guardian, but they all have the same flaw.
The additional step of decrypting the code will add a processing overhead and much like a DRM system all of the solutions on the market require that you have the encryption key available to the server running the code rendering the encryption trivial to defeat. It also introduces a load of new ways your code can go wrong.
An alternative approach is to supply the source as byte code or use PHPC or HipHop to supply the code as a C executable. This won't stop them using the application, but it will make it difficult for people to modify. I would personally only consider this approach for reasons of performance not for obfuscation.
Fundamentally the best way to deal with this issue is to make sure you have the right licences and agreements in place to cover you. Before you start a project it should always be clear who will own the source code at the end.
You get repeat work by delivering the best solution rather than locking customers in.
Zend have product called Zend Guard which can obfuscate your source code.
Another solution would be to deliver an already compiled version, you can use php compiler
or phalanger
.
Note: the obfuscation wouldn't block the user from using the code but would make it really difficult to upgrade/modify it. My opinion delivering a compiled version or just signing a proper contract would be the best options