views:

132

answers:

3

Hi, I am wondering if anyone has used or read about PHP scripts compiled as a .so extension for Apache... Thing is I think I remember reading about it somewhere but dont know if such a thing exists.

This looks promising, but incomplete and abandoned: http://phpcompiler.org/

Im interested because i think it could improve performance... Perhaps someone could point out a framework or apache extension that does this.

Thanks!!

+8  A: 

They do exist. There's HipHop Compiler for PHP by Facebook.
I don't know if it works with Apache, though.
You may want to take a look: http://developers.facebook.com/blog/post/358
Github repository: http://github.com/facebook/hiphop-php

Regards,
T.

Thiago Silveira
Sounds great, Ill check it out!
dabito
+4  A: 

If you want to improve the performance of your PHP scripts in this way, you should try something like Zend Accelerator. It keeps the bytecode around so it doesn't have to be recompiled on every request.

Byron Whitlock
I guess bytecode is better than interpreted at runtime. I was looking for compiled, but this looks easier to implement. Thanks!
dabito
Or use APC or eAccelerator, and not support Zend's attempt to commercialize the language. Also, they plan to implement APC into PHP 6 (but it will be turned off by default).
Daniel
@Daniel +1 on opposing Zend's plans =]
dabito
+3  A: 

Im interested because i think it could improve performance

This is a very loaded question. Yes, if you are handling more than a million hits per hour, then there are very real benefits in compiling PHP (see other answers about HipHop). But if you really meant to ask "how do I improve the performance of my website" then that's probably the last answer anyone should give you.

If you're objective is to make your site go faster, then you first need to establish methods of capturing the time it takes to service a request (preferably seperating network and database time from webserver time), and for capturing page turn times (i.e. the time it takes to load all the content on a page) then look at stuff like:

  • browser side caching
  • server side caching
  • opcode caching
  • query optimization
  • HTTP compression
  • OS and network tuning

etc.

C.

symcbean
+1 Benchmarks!!
Byron Whitlock
So you would suggest trying all this before trying to switch to a compiled language? Fair enough... However, I think that since you can still implement all of the forementioned techniques on compiled langs, ceteris paribus compilation would still give you an edge. Thanks a lot for the answer, Ill look up all the things I didnt know from the list.
dabito