Mixing HipHop with PHP

70 views
Skip to first unread message

Jett

unread,
Feb 5, 2010, 11:22:04 AM2/5/10
to HipHop for PHP Dev
I'm sure this will be pretty obvious once we're all able to look at
the code, just curious though if anyone has any idea how HipHop would
work for compiling portions of a PHP app - like say we have some
libraries we use that meet the criteria and are already optimized as
far as they'll go, can we use HipHop to compile it and then include it
in the rest of the PHP app? Or does the whole app need to be compiled
using HipHop?

Dave

Michael McGlothlin

unread,
Feb 5, 2010, 11:44:58 AM2/5/10
to hiphop-...@googlegroups.com
I hope it is smart enough that if you try to do something HipHop
doesn't support that it runs it in regular PHP. If not I'd call that a
must have fix.

Thanks,
Michael McGlothlin

Gregory Kornblum

unread,
Feb 5, 2010, 12:28:36 PM2/5/10
to hiphop-...@googlegroups.com
It is supposedly compiled into a PHP extension so you use the the same way you'd use GD for example.


Regards,
Gregory Kornblum

Vid Luther

unread,
Feb 5, 2010, 12:36:24 PM2/5/10
to hiphop-...@googlegroups.com
I think the question I'm most curious about is, how do things like
PDO/mysql/mysqli translate?

If I went from MySQL to Postgres in my PDO system, is it just as simple
as a recompile?


I know lots of questions that will only be answered once the code is
out, so sorry for adding to the barrage of questions.

Mark Cahill

unread,
Feb 5, 2010, 1:02:08 PM2/5/10
to hiphop-...@googlegroups.com
None of the above. It compiles your entire application. If you want part in HPHP and part in PHP, you'll have to have two separate virtualhosts and communicate via API. Compilation makes a web server binary - not a PHP extension, and not something that can be include()'d. Although this is speculation. Anyone on the team care to elaborate?

-Mark

Samuel ROZE

unread,
Feb 6, 2010, 2:51:41 AM2/6/10
to hiphop-...@googlegroups.com
I hope that the PDO extension and its modules (Postgres particulary,
even if fb use MySQL) are already rewrited!

2010/2/5, Vid Luther <thirdpa...@gmail.com>:

Samuel ROZE

unread,
Feb 6, 2010, 2:55:35 AM2/6/10
to hiphop-...@googlegroups.com
I would be so cool if we can build PHP extensions (.so) from a PHP
code using HipHop, but it is quite different from the based target of
HipHop ! :-)

2010/2/5, Mark Cahill <ma...@tiemonster.info>:

Romeo-Adrian Cioaba

unread,
Feb 6, 2010, 3:32:03 AM2/6/10
to hiphop-...@googlegroups.com
I hope it will work with Zend Framework :)
--
Romeo-Adrian Cioaba
email/gtalk: romeo....@spotonearth.com
SkypeID/Y!M: romeo.cioaba
MSN: romeo....@hotmail.com
http://www.myscienceisbetter.info

Disclaimer
The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee.  Access to this e-mail by anyone else is unauthorised.  If you are not the intended recipient please do not read, print, re-transmit, store, disclose, copy, distribute or act in reliance on it or any attachments.  Instead please e-mail it back to the sender and then immediately permanently delete it.  By opening any attachment to this e-mail you are expressly acknowledging that the attachment is subject to copyright, and you thereby undertake not to alter, copy, disseminate, re-transmit, rely upon or use the attachment except as expressly authorised by the sender.

Haiping Zhao

unread,
Feb 6, 2010, 3:39:07 AM2/6/10
to hiphop-...@googlegroups.com
Sorry I was not able to answer any of your questions, as I really want to
speed up the preparation of the code. But very quickly, "extension" area is
weak right now, in term of how to bridge existing PHP extensions and HipHop
extensions. Once you see the code, you will find out we had to manually
convert PHP extensions, because data structures are changed so much. We'll
collect thoughts on how to make this less painful to those not-converted
extensions. Perhaps programmatically setting up some bridge. We thought
about this before, but some global variables esp. resources gave us some
headache. If we go all the way allowing both sides linking the other side's
libraries, there may be a good chance, but that has its own drawback. So,
let's wait a little bit. When you have concrete idea what I'm talking about,
we can dive into more detailed discussions. Fresh ideas will be more than
welcome.

Here's a list of converted extensions, not in easily readable format, but
bear with me at this moment. You will see the code :-)

I. Language Internals
=========================

1. ext_variable 30 x
2. ext_function 14 x
3. ext_class 15 x
4. ext_error 11 x
5. ext_misc 25 x
6. ext_options 46 x
7. ext_apache 14 x
-------------------------
155 x

II. Data Types
=========================

01. ext_string 90 x
02. ext_url 10 x
03. ext_datetime 37 x
04. ext_array 72 x
05. ext_hash 10 x
06. ext_mcrypt 37 x
07. ext_openssl 39 x
08. ext_math 48 x
09. ext_bcmath 10 x
10. ext_json 02 x
-------------------------
355 x

III. System Functions
=========================

1. ext_output 17 x
2. ext_file 89 x
3. ext_stream 40 x
4. ext_socket 25 x
5. ext_network 32 x
6. ext_ipc 17 x
7. ext_process 25 x
8. ext_posix 35 x
-------------------------
280 x

IV. External Packages
=========================

01. ext_apc 10 x
02. ext_mysql 49 x
03. ext_preg 15 x
04. ext_zlib 22 x
05. ext_ctype 11 x
06. ext_curl 18 x
07. ext_apd 9 x
08. ext_iconv 11 x
09. ext_mb 55 x
10. ext_simplexml 7 x
11. ext_image 107 x
12. ext_xmlwriter 42 x

13. ext_ldap 43 -
14. ext_mailparse 16 - <-- ongoing
15. ext_xml 24 x
16. ext_magick 428 -
-------------------------
905

A "x" means fully converted, although there are few ones simply throw
NotSupportedException, due to model changes (very few of them). A "-" means
not done at all. Numbers are function count. We're converting these ones
right now: PDO and mailparse. I think DOMDocument is done as well, just not
listed.

-Haiping

Samuel ROZE

unread,
Feb 6, 2010, 4:03:28 AM2/6/10
to hiphop-...@googlegroups.com
Thanks for your reply. You've rewrote some extensions, that's a good
thing. The problem is for Database connection.. If you're rewriting PDO,
are you rewriting each PDO drivers or just MySQL driver?

Of course, we'll see to the code and then speak more about it. Is there
any wiki available on the internal of HipHop, on Github for instance,
even if the code isn't released?

Thanks again for your job.
Regards,

Le samedi 06 février 2010 à 00:39 -0800, Haiping Zhao a écrit :
> Sorry I was not able to answer any of your questions, as I really want to
> speed up the preparation of the code.

[...]


> But very quickly, "extension" area is
> weak right now, in term of how to bridge existing PHP extensions and HipHop
> extensions. Once you see the code, you will find out we had to manually
> convert PHP extensions, because data structures are changed so much. We'll
> collect thoughts on how to make this less painful to those not-converted
> extensions. Perhaps programmatically setting up some bridge. We thought
> about this before, but some global variables esp. resources gave us some
> headache. If we go all the way allowing both sides linking the other side's
> libraries, there may be a good chance, but that has its own drawback. So,
> let's wait a little bit. When you have concrete idea what I'm talking about,
> we can dive into more detailed discussions. Fresh ideas will be more than
> welcome.

[...]

Haiping Zhao

unread,
Feb 6, 2010, 5:21:44 AM2/6/10
to hiphop-...@googlegroups.com
The PDO interface will be there, but depending on how much time we can
devote ourselves into extension implementation, we may choose 1 to 3 major
ones.

I'll have to let Scott answer the wiki question.

Thanks.

-Haiping

Samuel ROZE

unread,
Feb 6, 2010, 6:07:00 AM2/6/10
to hiphop-...@googlegroups.com
I think that if you rewrite two or three drivers, community may rewrite
others...

Well, I'll see source code. PDO will not be rewrote in the soon released
code if I well understood?

Still waiting for Scott's answer. :-)

Regards,
Samuel.

Harald Lapp

unread,
Feb 6, 2010, 10:02:49 AM2/6/10
to HipHop for PHP Dev
hello,

may i ask: what about memcache? i don't see any of the two memcache
extensions listet, but i thought facebook is heavily using memcache,
as well?

thanks,
harald

> On 2/5/10 11:55 PM, "Samuel ROZE" <samuel.r...@gmail.com> wrote:
>
>
>
> > I would be so cool if we can build PHP extensions (.so) from a PHP
> > code using HipHop, but it is quite different from the based target of
> > HipHop ! :-)
>

> > 2010/2/5, Mark Cahill <m...@tiemonster.info>:


> >> None of the above. It compiles your entire application. If you want part in
> >> HPHP and part in PHP, you'll have to have two separate virtualhosts and
> >> communicate via API. Compilation makes a web server binary - not a PHP
> >> extension, and not something that can be include()'d. Although this is
> >> speculation. Anyone on the team care to elaborate?
>
> >> -Mark
>
> >> On Fri, Feb 5, 2010 at 12:28 PM, Gregory Kornblum

> >> <phillyten...@gmail.com>wrote:


>
> >>> It is supposedly compiled into a PHP extension so you use the the same way
> >>> you'd use GD for example.
>
> >>> Regards,
> >>> Gregory Kornblum
>
> >>> On Fri, Feb 5, 2010 at 8:44 AM, Michael McGlothlin

> >>> <mogm...@gmail.com>wrote:


>
> >>>> I hope it is smart enough that if you try to do something HipHop doesn't
> >>>> support that it runs it in regular PHP. If not I'd call that a must have
> >>>> fix.
>
> >>>> Thanks,
> >>>> Michael McGlothlin
>

André Ferreira

unread,
Feb 6, 2010, 12:32:29 PM2/6/10
to HipHop for PHP Dev
You can communicate with memcache directly via TCP / UDP, this may be
how Facebook is storing / retreiving their data and not using the
extension (as far as I know the interface is fairly simple).

Harald Lapp

unread,
Feb 6, 2010, 12:42:50 PM2/6/10
to HipHop for PHP Dev
yes -- of course you would have to implement your own higher level
interface than. anyway ... speed should not be a problem anymore for
such a solution.

Haiping Zhao

unread,
Feb 6, 2010, 12:47:05 PM2/6/10
to hiphop-...@googlegroups.com
We do have our own memcache extension, and we'd like to open source that as
well :-) Whether or not it's part of HipHop, we haven't decided yet, but it
won't take very long for you to use them.

-Haiping

Harald Lapp

unread,
Feb 6, 2010, 12:57:11 PM2/6/10
to HipHop for PHP Dev
cool! thanks very much :-)

harald

On 6 Feb., 18:47, Haiping Zhao <hz...@facebook.com> wrote:
> We do have our own memcache extension, and we'd like to open source that as
> well :-) Whether or not it's part of HipHop, we haven't decided yet, but it
> won't take very long for you to use them.
>
> -Haiping
>

Reply all
Reply to author
Forward
0 new messages