5

Possible Duplicate:
Using Hiphop for PHP extension development

This question is similar to the following: Using Hiphop for PHP extension development

I do not think that question was answered properly, if at all.

I am sure you can use HipHop PHP to convert a php file to C++, without adding facebooks webserver. So, you would just have your php file converted to C++ source. Could you then compile that code to a php extension? I have some security related functions that I would like to compile to extensions, but I dont know C/C++. And please, no responses of "are you as big as facebook? you dont need hiphop", or "Use Ioncube/Zend Guard". I know those products exist. They are also expensive.

Community
  • 1
  • 1
  • If there's a problem with another question you should leave a comment there, or flag for a moderator if appropriate. – Joe Nov 25 '13 at 17:34

2 Answers2

3

I asked Scott MacVicar about this very subject at a conference last year (I want to build some of my own libraries as extensions), and got the response that HipHop cannot be used to build extensions that can then be built against "standard" Zend PHP.

That's why I've been looking at alternatives such as phc that can convert PHP scripts to C-language extensions for PHP (as well as build executables from PHP source)

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • Have you had any luck with phc? Were you able to use it to compile an extension? – Trevor Thomas Apr 19 '12 at 22:36
  • @Trevor - sadly not in its current state, I'm brushing up on my C and looking at extending phc to correctly build class constants, thrown exceptions, and other features that it can't handle at present... it's got a lot going for it, but isn't quite all there yet – Mark Baker Apr 19 '12 at 23:04
0

It gets compiled as C++, if you use the tack ./hphp/hphp text.php --keep-tempdir=1 you can keep the C++ code as well as the compiled code

You can potentially use HipHop PHP to convert your PHP file to C++ it is possible to build extensions.

Quote from HipHop site

One of the explicit design goals leading into HipHop was the ability to continue writing complex logic directly within PHP. Companies with large PHP codebases will generally rewrite their complex functionality directly as PHP extensions in either C or C++. Doing so ends up reducing the number of people who are able to work on the company’s entire codebase. By keeping this logic in PHP, Facebook is able to move fast and maintain a high number of engineers who are able to work across the entire codebase.

Pez Cuckow
  • 14,048
  • 16
  • 80
  • 130