Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Extending PHP with Erlang/YAWS.

Guest
Posted: Sun Sep 17, 2006 1:23 pm Reply with quote
Guest
Hi All,

I need to extend a PHP application with some Erlang-based server functionality. More specifically, the Erlang app's role is to provide some services for which non-trivial state must be maintained, and which will be queried by an AJAX client periodically (the client is currently being written using PHP as the "primary" backend - there is a chance that YAWS could be accepted as the server for that part, but probably not at this time).
So, my question is this: how should one perform such integration? The methods I've basically come up with are:
1) Open a socket from a PHP script and query the Erlang backend using a proprietary protocol (the queries are simple, but might return a couple KB). Is JSON generally more convenient for relatively flat datastructures?
2) As (1) above, but let the Erlang backend build the Javascript part (incl. JSON/other response data).
3) As (1) but extend the PHP interpreter so it opens a persistent connection. Does anyone know how hard this might be? AFAIK Apache threads are mapped to PHP threads, which "share nothing". Is this correct?
4) Somehow get Management to agree on moving the entire AJAX bit to YAWS (unlikely). In this case, I would open a separate socket for YAWS.

Regards,
Alex.


Post recived from mailinglist
noss
Posted: Sun Sep 17, 2006 1:47 pm Reply with quote
User Joined: 09 Oct 2005 Posts: 290
I excluded cross posting to erlang-questions.

It is quite difficult to answer your inquiry since you are vague in
describing the problem and what constricts your possible solutions.

If you are confident in yaws and know that you can reimplement what
the php code in erlang/yaws in financially sound time I think this is
the best move. Most likely situation: Managment will not agree to
_try_ this approach if you ask them permission. If you do it anyway
you have the scenarios:
a) they will see that it works and just trust your judgement as the engineer
b) they will complain loudly that you picked a platform "nobody ever
heard of" and that they will not be able to replace you if you ever
leave (not that it is true)

If you feel that you are taking a risk by doing something without
permission, then that is exactly the same feeling managment will feel
if they give you explicit permission to try it. In the end, it is
about you using PHP for day-to-day work or using erlang. What do you
want and what are you willing to risk?

Is the problem that php needs to share state with erlang and erlang
share state with php? If so I suggest that you backend in a database
both erlang and php cant talk to. Databases make great cross-language
integration points.

Is the problem that you want both web servers accessible behind the
same domain/IP address then I think you should look at having apache
forward requests to yaws (or other way around, though: yaws' request
relaying is documented as being a bit beta-ish).

PS.
Is yaws' ability to start php on each request to run .php scripts not an option?

On 9/17/06, Alex Arnon <alex.arnon@gmail.com> wrote:
> Hi All,
>
> I need to extend a PHP application with some Erlang-based server
> functionality. More specifically, the Erlang app's role is to provide some
> services for which non-trivial state must be maintained, and which will be
> queried by an AJAX client periodically (the client is currently being
> written using PHP as the "primary" backend - there is a chance that YAWS
> could be accepted as the server for that part, but probably not at this
> time).
> So, my question is this: how should one perform such integration? The
> methods I've basically come up with are:
> 1) Open a socket from a PHP script and query the Erlang backend using a
> proprietary protocol (the queries are simple, but might return a couple KB).
> Is JSON generally more convenient for relatively flat datastructures?
> 2) As (1) above, but let the Erlang backend build the Javascript part (incl.
> JSON/other response data).
> 3) As (1) but extend the PHP interpreter so it opens a persistent
> connection. Does anyone know how hard this might be? AFAIK Apache threads
> are mapped to PHP threads, which "share nothing". Is this correct?
> 4) Somehow get Management to agree on moving the entire AJAX bit to YAWS
> (unlikely). In this case, I would open a separate socket for YAWS.
>
> Regards,
> Alex.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> _______________________________________________
> Erlyaws-list mailing list
> Erlyaws-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message
Guest
Posted: Sun Sep 17, 2006 2:51 pm Reply with quote
Guest
On 9/17/06, Christian S <chsu79@gmail.com (chsu79@gmail.com)> wrote:
Quote:
I excluded cross posting to erlang-questions.

It is quite difficult to answer your inquiry since you are vague in
describing the problem and what constricts your possible solutions.

If you are confident in yaws and know that you can reimplement what
the php code in erlang/yaws in financially sound time I think this is
the best move. Most likely situation: Managment will not agree to
_try_ this approach if you ask them permission. If you do it anyway
you have the scenarios:
a) they will see that it works and just trust your judgement as the engineer
b) they will complain loudly that you picked a platform "nobody ever
heard of" and that they will not be able to replace you if you ever
leave (not that it is true)
Quote:
If you feel that you are taking a risk by doing something without
permission, then that is exactly the same feeling managment will feel
if they give you explicit permission to try it. In the end, it is
about you using PHP for day-to-day work or using erlang. What do you
want and what are you willing to risk?

Agreed. I am still trying to find out how much room I'll have to maneuver.
As it stands, I'll probably be able to try moving the entire application to Yaws at a later stage in the project. I'm certain it can be done within a reasonable amount of time/budget.

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum