Can we build PHP 5 Class?
Moderator: General Moderators
- olog-hai
- Forum Commoner
- Posts: 34
- Joined: Thu May 31, 2007 8:47 am
- Location: Québec city, QC, Canada
Can we build PHP 5 Class?
Hi,
I just want to know if it's doable to build or compile php5 class ? Apache 2 can support this ?
Thanks.
I just want to know if it's doable to build or compile php5 class ? Apache 2 can support this ?
Thanks.
- olog-hai
- Forum Commoner
- Posts: 34
- Joined: Thu May 31, 2007 8:47 am
- Location: Québec city, QC, Canada
Is it the way to work with php 5 compiled class ?
I've a web site that use PHP 5 class, I want to know if I can compile this class and use them ? it's only for a performance purpose
in other word: Like microsoft .NET, all class is compiled and ISS load these compiled class in memory and work with them.
with PHP5 and Apache 2, can we have this kind of behavior ?
compiled class is really faster than interpreted php file right ?
thanks.
I've a web site that use PHP 5 class, I want to know if I can compile this class and use them ? it's only for a performance purpose
in other word: Like microsoft .NET, all class is compiled and ISS load these compiled class in memory and work with them.
with PHP5 and Apache 2, can we have this kind of behavior ?
compiled class is really faster than interpreted php file right ?
thanks.
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
I believe I understand where your coming from, you want to know if you can compile your script into machine-code and be interpreted ONCE, instead of wasting precious time interpreting it EVERY run just to get the same effect with more time wasted.
The Answer is:
Yes and No, unlike what you have read above, not saying they're wrong (once they see what I'm talking about they'll agree or research it), but they are forgetting an important extension for PHP. I'm not sure how fimilar you are with Caches (now you ppl know where I'm going?), but there is a little program called APC (http://us.php.net/apc) that, once a script is first compiled, will save the machine-coded version in a cache for a preset time. Please note however, that doing this has it's "ups and downs", while increasing speed and productivity, it will not work for most dynamic corners of web applications. I suggest you do more research into this program and test it out before going public.
The Answer is:
Yes and No, unlike what you have read above, not saying they're wrong (once they see what I'm talking about they'll agree or research it), but they are forgetting an important extension for PHP. I'm not sure how fimilar you are with Caches (now you ppl know where I'm going?), but there is a little program called APC (http://us.php.net/apc) that, once a script is first compiled, will save the machine-coded version in a cache for a preset time. Please note however, that doing this has it's "ups and downs", while increasing speed and productivity, it will not work for most dynamic corners of web applications. I suggest you do more research into this program and test it out before going public.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
There are ways of compiling PHP into a byte-code so it executes at speeds equivelant to ASP.NET however neither will come close to a well tuned nativley compiled C application.
Writing CGI using plain vanilla C is a *lot* of work thats why most just stick to Perl or PHP. Unless the speed increase is really needed the etrax effort isn't worth it.
There is however a PHP compiler, which does something similar to a native C compiler.
Google for Roadsend you'll find there.
Writing CGI using plain vanilla C is a *lot* of work thats why most just stick to Perl or PHP. Unless the speed increase is really needed the etrax effort isn't worth it.
There is however a PHP compiler, which does something similar to a native C compiler.
Google for Roadsend you'll find there.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Seriously, PHP interprests very quickly. In many cases, .NET apps run at the same speed as PHP apps run when the servers (web, file, database, etc) are all configured properly AND the code used in the app is optimized correctly. Overall speed differences are negligible when it comes to performance. In my opinion.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
You need to profile your application and start wood-shedding the parts that are slow.
But to answer your question, you can cache PHP's "opcodes" using APC.
But to answer your question, you can cache PHP's "opcodes" using APC.