Page 1 of 1

Protecting .php files from being modified

Posted: Fri Oct 10, 2008 3:10 pm
by kaisellgren
Hi,

I have an open source project and I would like to prevent people from modifying one .php file. I have been thinking a lot. I would not like to put zend encoding on the file or other alternatives. I've been thinking about making an automatic update system that updates all project files (also back to normal state if someone modified).

Any ideas?

Re: Protecting .php files from being modified

Posted: Sat Oct 11, 2008 3:31 am
by Mordred
1. It would not be open source if you put restrictions like this.
2. You can do some smart things to fool the dumb users, but as soon as a smart user figures it out, your "protection" is gone.
3. Maybe you should describe the problem more thoroughly - why do you need to protect this file, what's so important in it?

Re: Protecting .php files from being modified

Posted: Sun Oct 12, 2008 11:11 am
by alex.barylski
Very little you can do...encoding isn't going to help.

Your best bet...if all you need is to protect one PHP file is to write it as an extension.

Alternatively if it's not code you are protecting but just ensuring the function never changes you could maybe store the function on a remote server you control and then implement a custom stream wrapper so when that file is included you download the remote file via FTP or HTTP (the latter preferably) and let PHP do it's thing.

Cheers,
Alex

Re: Protecting .php files from being modified

Posted: Sun Oct 12, 2008 11:23 am
by Eran
The last line about an update makes me think you are intending to use a source versioning scheme such as SVN to distribute the code. If that is the case, you can set up permissions through it any way you like and prevent commits to particular parts in the code.
This doesn't prevent people from modifying it for their own personal use though.