[nycphp-talk] PHP scripts running in JBoss
Daniel Krook
krook at us.ibm.com
Mon Feb 23 16:47:36 EST 2009
Hi Artur,
Artur Marnik <artur at marnik.net> wrote on 02/23/2009 03:42:31 PM:
> Hi All
>
> In my company we are using Linux servers where we have
> PHP, mysql and
> all other nice stuff. My new manager is a Java guy and he
> always worked
> with Java and his new idea is to move all our stuff to
> Jboss. There is
> only one problem - we don't have enough time to migrate
> all of our PHP
> code to some Java stuff and he wants to install PHP
> servlet inside jboss
> to serve PHP content. Idea is ok but all info I could find
> in google is
> how to do it in Windows :( and all php5servlets that I
> found are for
> windows (php5servlet.dll). Has anyone ever done something
> similar and
> have an idea at least where to start?
>
> Thanks
> Artur
There are a few ways to approach PHP/JEE application server integration,
and the solution you pick depends on the answer to a few questions:
- Is this a straight conversion of your applications from PHP to Java? Or
do you intend to leave some portion in PHP?
- Do you need your PHP and Java application modules to communicate with
each other?
- What sort of transition plan are you looking at? Phased, or complete in
one shot? Only new features in Java?
- What benefit - besides being more comfortable with Java as a language -
is your manager looking to get from Java as a platform? PHP is better at
some things, Java, others.
- Why JBoss and not just Tomcat or Geronimo? Or any other JEE application
server for that matter?
In my opinion, the best place to start is to use Apache as a front end to
both your PHP and JEE applications, and let Apache decide which to
delegate the request to based on the URL pattern.
In this scenario, JBoss and PHP would know nothing about each other, but
could share data via MySQL or client-side cookies. This is good for
supporting a phased approach and keeps your inter-Java/PHP dependencies to
a minimum.
This article is close to 4 years old, but it covers this scenario in a
WebSphere specific way (though the concepts are generic):
Pair J2EE with PHP to implement a common Web application infrastructure
http://www.ibm.com/developerworks/websphere/techjournal/0505_krook/0505_krook.html
You could also explore PHP / Java integration via a bridge using several
approaches:
http://krook.net/archives/191
Or, use a PHP interpreter written in Java (my least favorite option... but
gaining in popularity), integrating Java and PHP in the same JVM, which is
what Quercus, Project Zero and others do:
http://www.projectzero.org/
http://www.caucho.com/resin-3.0/quercus/
Thanks,
-Dan
Daniel Krook
Senior IT Specialist - Tools Team Lead, Global Solutions, ibm.com
IBM Certified IT Specialist, SCSA, SCJP, SCWCD, ZCE, ICDAssoc., ICAD
More information about the talk
mailing list