File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes php as a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "php as a servlet" Watch "php as a servlet" New topic

php as a servlet

mahesh narayan
Ranch Hand

Joined: Aug 12, 2003
Posts: 41

I was trying to run php as a servlet in websphere application server. But hard luck... i am just not able to figure out how to go about it.... can anyone help me ?

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

a Servlet is Java, PHP is not.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
In tomcat we have the CGI servlet that lets you run PERL cgi scripts, seems to me you should be able to use it to run PHP scripts.
mahesh narayan
Ranch Hand

Joined: Aug 12, 2003
Posts: 41
Sorry Mark for being vague about my question.What i meant was to ask whether i can integrate PHP into a Java Servlet environment. Though i could find some doc on googling, but it couldnt help me how to do tht in websphere application server.It would be really helpful if someone can provide me pointers on how to do it.

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

You can call Java Code from PHP - there is a Servlet SAPI module, which you can get if you look on PHP's site. Or you can use the Java Extension stuff (again, look on PHP's site) but that's very definitely at the alpha stage. Take this all with a pinch of salt though - Java is a far richer language than PHP, so you are bound to fine some horrible gotchas trying to use them in the same app.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
mahesh narayan
Ranch Hand

Joined: Aug 12, 2003
Posts: 41
Thanks Paul.

I have used Java Bridge to call java from Php. And is seems to work fine.

I agree. Here's the link:
subject: php as a servlet
It's not a secret anymore!