Do compiled PHP scripts exist?
Asked Answered
O

3

7

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!!

Overland answered 25/5, 2010 at 20:38 Comment(0)
A
9

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

Assignee answered 25/5, 2010 at 20:40 Comment(1)
Sounds great, Ill check it out!Overland
D
6

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.

Deportation answered 25/5, 2010 at 20:40 Comment(3)
I guess bytecode is better than interpreted at runtime. I was looking for compiled, but this looks easier to implement. Thanks!Overland
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).Circinate
@Circinate +1 on opposing Zend's plans =]Overland
B
6

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.

Billen answered 26/5, 2010 at 13:18 Comment(1)
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.Overland

© 2022 - 2024 — McMap. All rights reserved.