views:

134

answers:

5

I'm curious that whether all PHP product must be open sourced if it is to be deployed to other's web site. Since PHP code is executed by interpretation, if I have PHP product to be deployed on other's host, it seems no reason to prevent others view the source code.

So, PHP product is destined to be open source, right?

To be more precise, suppose I make a PHP blog system. I'd like to sale this product to some blog hosting company. Is it true that I cannot prevent them from viewing my source code if they buy it?

+7  A: 

Open source is about the license to get the source code and not about the ability to view it ... Even with compiled languages it is possible to extract source code - which does not make the code open source automatically - but any open source license can even turn this binary code into open source.

tanascius
+2  A: 

Putting uncompiled or non-obfuscated code onto a server doesn't qualify it as "open source". To be open source the code has to be distributed in a certain way under certain guidlines. Simply putting code on a server doesn't make it open source.

There are many projects in compiled languages that are open source.

Jamie Dixon
A: 

No.

Yes, it's destined to be "open source" in the sense that anyone with access to the server is going to be able to view it.

True "open source" projects have the source code distributed. If no one has access to the server then they can't get the source code anyways. However, if you write an application for a company, and put the code on their server, they will have access to the source and be able to examine / modify it. This shouldn't be an issue though because technically they own the code (if they paid for it).

Josh K
Why is it a bad idea?
rjh
Edited answer, and see http://www.codinghorror.com/blog/2005/05/obfuscating-code.html
Josh K
"...technically they own the code (if they paid for it)." That's a contractual thing and is absolutely NOT necessarily true. Take Windows - you paid for it, but you certainly don't have the right to examine or modify it. In the OP's question, it sounds more like he's selling a product which is licensed, and he certainly can write the license agreement to prohibit code changes. (This is opposed to a contract job where copyright would likely vest with the purchasing company.)
josh3736
Yes, but windows has an EULA you sign. This still doesn't stop people from cracking commercial PHP software like vBulletin.
Josh K
A: 

I've seen people do this before:

exec(base64_decode(''));

Although not "perfect" it can hide it from curious lookers. However, I wouldn't recommend hiding your code though. If you make it in open source products, the application should be opensource as well. Just slap on a license on it.

Daniel
A: 

Yes, it is possible. Zend Guard can encrypt your source code. The server then simply needs to use the Zend Optimizer to be able to execute your application

I've never tried it though, so I have no experience.

Cassy