Compressing a PHP file ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
christian_phpbeginner
Forum Contributor
Posts: 136
Joined: Sat Jun 03, 2006 2:43 pm
Location: Java

Compressing a PHP file ?

Post by christian_phpbeginner »

Hello folks,

I have several questions...

When we compress PHP file, would it load faster on the web ?
What tools to compress a PHP file and where can I find it ? (Sure, I have googled it, but what I found was not a compressor to compress PHP files, infact I found more on PHP files to compress Javascript files.)

Thanks,
Chris
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Compressing a PHP file will surely only slow things down. PHP is pre-processed on the server so making the PHP file smaller will not reduce bandwidth. You can use GZip comrpession in Apache to compress returned data streams though.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You can also look at ob_gzhandler()
User avatar
christian_phpbeginner
Forum Contributor
Posts: 136
Joined: Sat Jun 03, 2006 2:43 pm
Location: Java

Thank you !

Post by christian_phpbeginner »

Well, thanks for the responses so far.

But, how to prevent someone who works at a web hosting company grab one of your PHP file and use it without your permission ?

Thanks,
Chris
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Thank you !

Post by onion2k »

christian_phpbeginner wrote:But, how to prevent someone who works at a web hosting company grab one of your PHP file and use it without your permission ?
You could use an encoder, but ultimately they're reversible to someone who knows what they're doing. The best advice if you're worried about that happening is to either run your own server and not let anyone else have access (lots of extra work), or relax and understand that it's unlikely someone will steal your code, and even if they do there's not much to worry about. If your business really depends on your source code remaining unique and secret then host it yourself.

You should also remember that there's thousands of very clever people out there who are more than capable of replicating pretty much anything even without access to the code. If your idea is valuable then someone will copy it. Fact of life. Succeed by doing it better.
User avatar
christian_phpbeginner
Forum Contributor
Posts: 136
Joined: Sat Jun 03, 2006 2:43 pm
Location: Java

Re: Thank you !

Post by christian_phpbeginner »

onion2k wrote:
christian_phpbeginner wrote:But, how to prevent someone who works at a web hosting company grab one of your PHP file and use it without your permission ?
You could use an encoder, but ultimately they're reversible to someone who knows what they're doing. The best advice if you're worried about that happening is to either run your own server and not let anyone else have access (lots of extra work), or relax and understand that it's unlikely someone will steal your code, and even if they do there's not much to worry about. If your business really depends on your source code remaining unique and secret then host it yourself.

You should also remember that there's thousands of very clever people out there who are more than capable of replicating pretty much anything even without access to the code. If your idea is valuable then someone will copy it. Fact of life. Succeed by doing it better.
Hi onion2k,

Thanks for the advice and input ! I appreciated it.

Actually, I just wondering about it, because today at a cafe. Me and a view friends of mine gathered and discussed about this, but it seems there is no other way than encode it.

I know that there lots of very clever people out there who can design a system just by viewing the GUI...It's a good thing and it should be, because knowledge is open source.

But to me, it's too bad that the web hosting company could not do anything to prevent their workers from stealing their client's code. But, as you said it, FACT of LIFE !
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That is the case with any company and company data. What is to stop someone that works where I work from taking information off of one of the computers? Nothing. Same holds true for web hosts.

Ultimately, if you are not interested in running your own server, you are usually glad someone has access to the server so when the network pukes or the server dies, someone can fix it for you. It is actually pretty nice to have. But when the rubber meets the road, the hosts have better things to worry about for their business than snagging a customers code and trying to use it for their advantage.

Even moreso when the company has thousands of hosted accounts with many files per account.
Post Reply