php via CGI

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

php via CGI

Daniele-29
OS: MAC OS X 10.4.11
Jetty: 6.1.8

Since hours I try to configure jetty to work with php files.(via CGI)


I thought this snippet of code in my web.xml should be enough to get the php files work:
---------------------------------------------------------------------------
<servlet>
  <servlet-name>PHP-CGI</servlet-name>
  <servlet-class>org.mortbay.servlet.CGI</servlet-class>
  <init-param>
    <param-name>commandPrefix</param-name>
    <param-value>/usr/local/bin/php-cgi-fi</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
  <servlet-name>PHP-CGI</servlet-name>
  <url-pattern>*.php</url-pattern>
</servlet-mapping>
---------------------------------------------------------------------------
I get a 500:

java.io.IOException: /Users/dapo/projekte/jetty/jetty-6.1.8/webapps/phpTest/index.php: cannot execute
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:52)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at org.mortbay.servlet.CGI.exec(CGI.java:268)
at org.mortbay.servlet.CGI.service(CGI.java:193)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)

Can you help me? Where am I wrong?
Thank you very much!
Daniele

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: php via CGI

Daniel Lopez-2
I can't help you with PHP+CGI, but I got PHP working inside Jetty
using Quercus (100% Java implementation so no natve binaries required)
so I know's that's possible.

http://quercus.caucho.com/

In case it helps,
D.


2008/3/13, Daniel Poodratchi <[hidden email]>:

>
> OS: MAC OS X 10.4.11
> Jetty: 6.1.8
>
> Since hours I try to configure jetty to work with php files.(via CGI)
> http://docs.codehaus.org/display/JETTY/Jetty+and+PHP does
> not really help.
>
>
> I thought this snippet of code in my web.xml should be enough to get the php
> files work:
> ---------------------------------------------------------------------------
> <servlet>
>   <servlet-name>PHP-CGI</servlet-name>
>   <servlet-class>org.mortbay.servlet.CGI</servlet-class>
>   <init-param>
>     <param-name>commandPrefix</param-name>
>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>   </init-param>
>   <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
>   <servlet-name>PHP-CGI</servlet-name>
>   <url-pattern>*.php</url-pattern>
> </servlet-mapping>
> ---------------------------------------------------------------------------
> I get a 500:
>
>
> java.io.IOException:
> /Users/dapo/projekte/jetty/jetty-6.1.8/webapps/phpTest/index.php:
> cannot execute
>  at java.lang.UNIXProcess.forkAndExec(Native Method)
>  at java.lang.UNIXProcess.(UNIXProcess.java:52)
>  at java.lang.ProcessImpl.start(ProcessImpl.java:91)
>  at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
>  at java.lang.Runtime.exec(Runtime.java:591)
>  at java.lang.Runtime.exec(Runtime.java:429)
>  at org.mortbay.servlet.CGI.exec(CGI.java:268)
>  at org.mortbay.servlet.CGI.service(CGI.java:193)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>  at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>  at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>  at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>  at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>  at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>  at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>  at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
>  at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>  at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>  at org.mortbay.jetty.Server.handle(Server.java:324)
>  at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>  at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
>  at
> org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>  at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>  at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>  at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>  at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>
> Can you help me? Where am I wrong?
> Thank you very much!
> Daniele
>
> -------------------------------------------------------------------------
>  This SF.net email is sponsored by: Microsoft
>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
>  Jetty-support mailing list
>  [hidden email]
>  https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: php via CGI

Daniele-29
Thank you for this link! It seems to be very interesting.

But how to use quercus with jetty? It seems to be a module for resin.

Thank you very much.
Daniele

Am 13.03.2008 um 08:05 schrieb Daniel Lopez:

> I can't help you with PHP+CGI, but I got PHP working inside Jetty
> using Quercus (100% Java implementation so no natve binaries required)
> so I know's that's possible.
>
> http://quercus.caucho.com/
>
> In case it helps,
> D.
>
>
> 2008/3/13, Daniel Poodratchi <[hidden email]>:
>>
>> OS: MAC OS X 10.4.11
>> Jetty: 6.1.8
>>
>> Since hours I try to configure jetty to work with php files.(via CGI)
>> http://docs.codehaus.org/display/JETTY/Jetty+and+PHP does
>> not really help.
>>
>>
>> I thought this snippet of code in my web.xml should be enough to  
>> get the php
>> files work:
>> ---------------------------------------------------------------------
>> ------
>> <servlet>
>>   <servlet-name>PHP-CGI</servlet-name>
>>   <servlet-class>org.mortbay.servlet.CGI</servlet-class>
>>   <init-param>
>>     <param-name>commandPrefix</param-name>
>>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>>   </init-param>
>>   <load-on-startup>1</load-on-startup>
>> </servlet>
>>
>> <servlet-mapping>
>>   <servlet-name>PHP-CGI</servlet-name>
>>   <url-pattern>*.php</url-pattern>
>> </servlet-mapping>
>> ---------------------------------------------------------------------
>> ------
>> I get a 500:
>>
>>
>> java.io.IOException:
>> /Users/dapo/projekte/jetty/jetty-6.1.8/webapps/phpTest/index.php:
>> cannot execute
>>  at java.lang.UNIXProcess.forkAndExec(Native Method)
>>  at java.lang.UNIXProcess.(UNIXProcess.java:52)
>>  at java.lang.ProcessImpl.start(ProcessImpl.java:91)
>>  at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
>>  at java.lang.Runtime.exec(Runtime.java:591)
>>  at java.lang.Runtime.exec(Runtime.java:429)
>>  at org.mortbay.servlet.CGI.exec(CGI.java:268)
>>  at org.mortbay.servlet.CGI.service(CGI.java:193)
>>  at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>  at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>> 487)
>>  at
>> org.mortbay.jetty.servlet.ServletHandler.handle
>> (ServletHandler.java:362)
>>  at
>> org.mortbay.jetty.security.SecurityHandler.handle
>> (SecurityHandler.java:216)
>>  at
>> org.mortbay.jetty.servlet.SessionHandler.handle
>> (SessionHandler.java:181)
>>  at
>> org.mortbay.jetty.handler.ContextHandler.handle
>> (ContextHandler.java:726)
>>  at
>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>  at
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle
>> (ContextHandlerCollection.java:206)
>>  at
>> org.mortbay.jetty.handler.HandlerCollection.handle
>> (HandlerCollection.java:114)
>>  at
>> org.mortbay.jetty.handler.HandlerWrapper.handle
>> (HandlerWrapper.java:152)
>>  at org.mortbay.jetty.Server.handle(Server.java:324)
>>  at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
>> 505)
>>  at
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
>> (HttpConnection.java:828)
>>  at
>> org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>  at
>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>  at
>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>  at
>> org.mortbay.io.nio.SelectChannelEndPoint.run
>> (SelectChannelEndPoint.java:395)
>>  at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run
>> (BoundedThreadPool.java:450)
>>
>> Can you help me? Where am I wrong?
>> Thank you very much!
>> Daniele
>>
>> ---------------------------------------------------------------------
>> ----
>>  This SF.net email is sponsored by: Microsoft
>>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>>  Jetty-support mailing list
>>  [hidden email]
>>  https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: php via CGI

Daniele-29
In reply to this post by Daniel Lopez-2
Sorry, I didn't recognize, that the download file is a war file. I  
deployed the webapp and it works! Great!

Thank you very much!
Daniele

Am 13.03.2008 um 08:05 schrieb Daniel Lopez:

> I can't help you with PHP+CGI, but I got PHP working inside Jetty
> using Quercus (100% Java implementation so no natve binaries required)
> so I know's that's possible.
>
> http://quercus.caucho.com/
>
> In case it helps,
> D.
>
>
> 2008/3/13, Daniel Poodratchi <[hidden email]>:
>>
>> OS: MAC OS X 10.4.11
>> Jetty: 6.1.8
>>
>> Since hours I try to configure jetty to work with php files.(via CGI)
>> http://docs.codehaus.org/display/JETTY/Jetty+and+PHP does
>> not really help.
>>
>>
>> I thought this snippet of code in my web.xml should be enough to  
>> get the php
>> files work:
>> ---------------------------------------------------------------------
>> ------
>> <servlet>
>>   <servlet-name>PHP-CGI</servlet-name>
>>   <servlet-class>org.mortbay.servlet.CGI</servlet-class>
>>   <init-param>
>>     <param-name>commandPrefix</param-name>
>>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>>   </init-param>
>>   <load-on-startup>1</load-on-startup>
>> </servlet>
>>
>> <servlet-mapping>
>>   <servlet-name>PHP-CGI</servlet-name>
>>   <url-pattern>*.php</url-pattern>
>> </servlet-mapping>
>> ---------------------------------------------------------------------
>> ------
>> I get a 500:
>>
>>
>> java.io.IOException:
>> /Users/dapo/projekte/jetty/jetty-6.1.8/webapps/phpTest/index.php:
>> cannot execute
>>  at java.lang.UNIXProcess.forkAndExec(Native Method)
>>  at java.lang.UNIXProcess.(UNIXProcess.java:52)
>>  at java.lang.ProcessImpl.start(ProcessImpl.java:91)
>>  at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
>>  at java.lang.Runtime.exec(Runtime.java:591)
>>  at java.lang.Runtime.exec(Runtime.java:429)
>>  at org.mortbay.servlet.CGI.exec(CGI.java:268)
>>  at org.mortbay.servlet.CGI.service(CGI.java:193)
>>  at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>  at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>> 487)
>>  at
>> org.mortbay.jetty.servlet.ServletHandler.handle
>> (ServletHandler.java:362)
>>  at
>> org.mortbay.jetty.security.SecurityHandler.handle
>> (SecurityHandler.java:216)
>>  at
>> org.mortbay.jetty.servlet.SessionHandler.handle
>> (SessionHandler.java:181)
>>  at
>> org.mortbay.jetty.handler.ContextHandler.handle
>> (ContextHandler.java:726)
>>  at
>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>  at
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle
>> (ContextHandlerCollection.java:206)
>>  at
>> org.mortbay.jetty.handler.HandlerCollection.handle
>> (HandlerCollection.java:114)
>>  at
>> org.mortbay.jetty.handler.HandlerWrapper.handle
>> (HandlerWrapper.java:152)
>>  at org.mortbay.jetty.Server.handle(Server.java:324)
>>  at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
>> 505)
>>  at
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
>> (HttpConnection.java:828)
>>  at
>> org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>  at
>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>  at
>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>  at
>> org.mortbay.io.nio.SelectChannelEndPoint.run
>> (SelectChannelEndPoint.java:395)
>>  at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run
>> (BoundedThreadPool.java:450)
>>
>> Can you help me? Where am I wrong?
>> Thank you very much!
>> Daniele
>>
>> ---------------------------------------------------------------------
>> ----
>>  This SF.net email is sponsored by: Microsoft
>>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>>  Jetty-support mailing list
>>  [hidden email]
>>  https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: php via CGI

Daniel Lopez-2
In reply to this post by Daniele-29
Hi,

It comes included for Resin, yes, but you can use it outside by
including the needed jars and configuring the servlet appropriately.
It "basically" is a servlet that handles .php requests, after all.

Note that you'll have to see if the php libraries you use are
supported, as there is no "specification" for the libraries, you'll
have to check it out. If they are not, you can revert to PHP-CGI or
ask the guys at Caucho to see if they are going to support those
libraries soon, they are open to requests.

S!
D.

2008/3/13, Daniele <[hidden email]>:

> Thank you for this link! It seems to be very interesting.
>
>  But how to use quercus with jetty? It seems to be a module for resin.
>
>
>  Thank you very much.
>  Daniele
>
>
> Am 13.03.2008 um 08:05 schrieb Daniel Lopez:
>
>
>  > I can't help you with PHP+CGI, but I got PHP working inside Jetty
>  > using Quercus (100% Java implementation so no natve binaries required)
>  > so I know's that's possible.
>  >
>  > http://quercus.caucho.com/
>  >
>  > In case it helps,
>  > D.
>  >
>  >
>  > 2008/3/13, Daniel Poodratchi <[hidden email]>:
>  >>
>  >> OS: MAC OS X 10.4.11
>  >> Jetty: 6.1.8
>  >>
>  >> Since hours I try to configure jetty to work with php files.(via CGI)
>  >> http://docs.codehaus.org/display/JETTY/Jetty+and+PHP does
>  >> not really help.
>  >>
>  >>
>  >> I thought this snippet of code in my web.xml should be enough to
>  >> get the php
>  >> files work:
>  >> ---------------------------------------------------------------------
>  >> ------
>  >> <servlet>
>  >>   <servlet-name>PHP-CGI</servlet-name>
>  >>   <servlet-class>org.mortbay.servlet.CGI</servlet-class>
>  >>   <init-param>
>  >>     <param-name>commandPrefix</param-name>
>  >>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>  >>   </init-param>
>  >>   <load-on-startup>1</load-on-startup>
>  >> </servlet>
>  >>
>  >> <servlet-mapping>
>  >>   <servlet-name>PHP-CGI</servlet-name>
>  >>   <url-pattern>*.php</url-pattern>
>  >> </servlet-mapping>
>  >> ---------------------------------------------------------------------
>  >> ------
>  >> I get a 500:
>  >>
>  >>
>  >> java.io.IOException:
>  >> /Users/dapo/projekte/jetty/jetty-6.1.8/webapps/phpTest/index.php:
>  >> cannot execute
>  >>  at java.lang.UNIXProcess.forkAndExec(Native Method)
>  >>  at java.lang.UNIXProcess.(UNIXProcess.java:52)
>  >>  at java.lang.ProcessImpl.start(ProcessImpl.java:91)
>  >>  at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
>  >>  at java.lang.Runtime.exec(Runtime.java:591)
>  >>  at java.lang.Runtime.exec(Runtime.java:429)
>  >>  at org.mortbay.servlet.CGI.exec(CGI.java:268)
>  >>  at org.mortbay.servlet.CGI.service(CGI.java:193)
>  >>  at
>  >> javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>  >>  at
>  >> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>  >> 487)
>  >>  at
>  >> org.mortbay.jetty.servlet.ServletHandler.handle
>  >> (ServletHandler.java:362)
>  >>  at
>  >> org.mortbay.jetty.security.SecurityHandler.handle
>  >> (SecurityHandler.java:216)
>  >>  at
>  >> org.mortbay.jetty.servlet.SessionHandler.handle
>  >> (SessionHandler.java:181)
>  >>  at
>  >> org.mortbay.jetty.handler.ContextHandler.handle
>  >> (ContextHandler.java:726)
>  >>  at
>  >> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>  >>  at
>  >> org.mortbay.jetty.handler.ContextHandlerCollection.handle
>  >> (ContextHandlerCollection.java:206)
>  >>  at
>  >> org.mortbay.jetty.handler.HandlerCollection.handle
>  >> (HandlerCollection.java:114)
>  >>  at
>  >> org.mortbay.jetty.handler.HandlerWrapper.handle
>  >> (HandlerWrapper.java:152)
>  >>  at org.mortbay.jetty.Server.handle(Server.java:324)
>  >>  at
>  >> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
>  >> 505)
>  >>  at
>  >> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
>  >> (HttpConnection.java:828)
>  >>  at
>  >> org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>  >>  at
>  >> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>  >>  at
>  >> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>  >>  at
>  >> org.mortbay.io.nio.SelectChannelEndPoint.run
>  >> (SelectChannelEndPoint.java:395)
>  >>  at
>  >> org.mortbay.thread.BoundedThreadPool$PoolThread.run
>  >> (BoundedThreadPool.java:450)
>  >>
>  >> Can you help me? Where am I wrong?
>  >> Thank you very much!
>  >> Daniele
>  >>
>  >> ---------------------------------------------------------------------
>  >> ----
>  >>  This SF.net email is sponsored by: Microsoft
>  >>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  >>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  >> _______________________________________________
>  >>  Jetty-support mailing list
>  >>  [hidden email]
>  >>  https://lists.sourceforge.net/lists/listinfo/jetty-support
>  >>
>  >>
>  >
>
> > ----------------------------------------------------------------------
>
> > ---
>  > This SF.net email is sponsored by: Microsoft
>  > Defy all challenges. Microsoft(R) Visual Studio 2008.
>  > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  > _______________________________________________
>  > Jetty-support mailing list
>  > [hidden email]
>  > https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>
>  -------------------------------------------------------------------------
>  This SF.net email is sponsored by: Microsoft
>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  _______________________________________________
>  Jetty-support mailing list
>  [hidden email]
>  https://lists.sourceforge.net/lists/listinfo/jetty-support
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: php via CGI

lwoggardner
In reply to this post by Daniele-29
Hi Daniele,

That IOException looks like the /usr/local/php-cgi-fi is missing and it
is trying to execute the script directly. You might need to turn on
debugging to see what the CGIServlet is doing.

I have an alternate CGI Servlet at http://jen.sourceforge.net that might
be useful for comparison.

Drop the following jar into your web-inf/lib (or somewhere on the jetty
classpath)
http://www.lastweekend.com.au/repository/au/com/lastweekend/jen/0.07/jen-0.07.jar

and a couple of changes to your web.xml

<servlet>
  <servlet-name>PHP-CGI</servlet-name>
  <servlet-class>au.com.lastweekend.cgi.CGIServlet</servlet-class>
  <init-param>
    <param-name>CGI_commandPrefix</param-name>
    <param-value>/usr/local/bin/php-cgi-fi</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>


Cheers,
        Grant.


On Thu, 2008-03-13 at 01:33 +0100, Daniel Poodratchi wrote:

> OS: MAC OS X 10.4.11
> Jetty: 6.1.8
>
>
> Since hours I try to configure jetty to work with php files.(via CGI)
> http://docs.codehaus.org/display/JETTY/Jetty+and+PHP does not really
> help.
>
>
>
>
> I thought this snippet of code in my web.xml should be enough to get
> the php files work:
> ---------------------------------------------------------------------------
> <servlet>
>   <servlet-name>PHP-CGI</servlet-name>
>   <servlet-class>org.mortbay.servlet.CGI</servlet-class>
>   <init-param>
>     <param-name>commandPrefix</param-name>
>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>   </init-param>
>   <load-on-startup>1</load-on-startup>
> </servlet>
>
>
> <servlet-mapping>
>   <servlet-name>PHP-CGI</servlet-name>
>   <url-pattern>*.php</url-pattern>
> </servlet-mapping>
> ---------------------------------------------------------------------------
> I get a 500:
>
>
> java.io.IOException: /Users/dapo/projekte/jetty/jetty-6.1.8/webapps/phpTest/index.php: cannot execute
> at java.lang.UNIXProcess.forkAndExec(Native Method)
> at java.lang.UNIXProcess.(UNIXProcess.java:52)
> at java.lang.ProcessImpl.start(ProcessImpl.java:91)
> at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
> at java.lang.Runtime.exec(Runtime.java:591)
> at java.lang.Runtime.exec(Runtime.java:429)
> at org.mortbay.servlet.CGI.exec(CGI.java:268)
> at org.mortbay.servlet.CGI.service(CGI.java:193)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
> at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
> at org.mortbay.jetty.HttpConnection
> $RequestHandler.headerComplete(HttpConnection.java:828)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
> at org.mortbay.thread.BoundedThreadPool
> $PoolThread.run(BoundedThreadPool.java:450)
>
>
> Can you help me? Where am I wrong?
> Thank you very much!
> Daniele
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________ Jetty-support mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/jetty-support


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: php via CGI

Daniele-29
Thank you guys!

I solved my problem. I tested both possibilities, they're working!

Very helpful mailing-list! Thank you.

Cheers,
Daniele


Am 13.03.2008 um 21:23 schrieb Grant Gardner:

> Hi Daniele,
>
> That IOException looks like the /usr/local/php-cgi-fi is missing  
> and it
> is trying to execute the script directly. You might need to turn on
> debugging to see what the CGIServlet is doing.
>
> I have an alternate CGI Servlet at http://jen.sourceforge.net that  
> might
> be useful for comparison.
>
> Drop the following jar into your web-inf/lib (or somewhere on the  
> jetty
> classpath)
> http://www.lastweekend.com.au/repository/au/com/lastweekend/jen/ 
> 0.07/jen-0.07.jar
>
> and a couple of changes to your web.xml
>
> <servlet>
>   <servlet-name>PHP-CGI</servlet-name>
>   <servlet-class>au.com.lastweekend.cgi.CGIServlet</servlet-class>
>   <init-param>
>     <param-name>CGI_commandPrefix</param-name>
>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>   </init-param>
>   <load-on-startup>1</load-on-startup>
> </servlet>
>
>
> Cheers,
>         Grant.
>
>
> On Thu, 2008-03-13 at 01:33 +0100, Daniel Poodratchi wrote:
>> OS: MAC OS X 10.4.11
>> Jetty: 6.1.8
>>
>>
>> Since hours I try to configure jetty to work with php files.(via CGI)
>> http://docs.codehaus.org/display/JETTY/Jetty+and+PHP does not really
>> help.
>>
>>
>>
>>
>> I thought this snippet of code in my web.xml should be enough to get
>> the php files work:
>> ---------------------------------------------------------------------
>> ------
>> <servlet>
>>   <servlet-name>PHP-CGI</servlet-name>
>>   <servlet-class>org.mortbay.servlet.CGI</servlet-class>
>>   <init-param>
>>     <param-name>commandPrefix</param-name>
>>     <param-value>/usr/local/bin/php-cgi-fi</param-value>
>>   </init-param>
>>   <load-on-startup>1</load-on-startup>
>> </servlet>
>>
>>
>> <servlet-mapping>
>>   <servlet-name>PHP-CGI</servlet-name>
>>   <url-pattern>*.php</url-pattern>
>> </servlet-mapping>
>> ---------------------------------------------------------------------
>> ------
>> I get a 500:
>>
>>
>> java.io.IOException: /Users/dapo/projekte/jetty/jetty-6.1.8/
>> webapps/phpTest/index.php: cannot execute
>> at java.lang.UNIXProcess.forkAndExec(Native Method)
>> at java.lang.UNIXProcess.(UNIXProcess.java:52)
>> at java.lang.ProcessImpl.start(ProcessImpl.java:91)
>> at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
>> at java.lang.Runtime.exec(Runtime.java:591)
>> at java.lang.Runtime.exec(Runtime.java:429)
>> at org.mortbay.servlet.CGI.exec(CGI.java:268)
>> at org.mortbay.servlet.CGI.service(CGI.java:193)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>> at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>> 487)
>> at
>> org.mortbay.jetty.servlet.ServletHandler.handle
>> (ServletHandler.java:362)
>> at
>> org.mortbay.jetty.security.SecurityHandler.handle
>> (SecurityHandler.java:216)
>> at
>> org.mortbay.jetty.servlet.SessionHandler.handle
>> (SessionHandler.java:181)
>> at
>> org.mortbay.jetty.handler.ContextHandler.handle
>> (ContextHandler.java:726)
>> at
>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>> at
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle
>> (ContextHandlerCollection.java:206)
>> at
>> org.mortbay.jetty.handler.HandlerCollection.handle
>> (HandlerCollection.java:114)
>> at
>> org.mortbay.jetty.handler.HandlerWrapper.handle
>> (HandlerWrapper.java:152)
>> at org.mortbay.jetty.Server.handle(Server.java:324)
>> at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
>> 505)
>> at org.mortbay.jetty.HttpConnection
>> $RequestHandler.headerComplete(HttpConnection.java:828)
>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>> at
>> org.mortbay.io.nio.SelectChannelEndPoint.run
>> (SelectChannelEndPoint.java:395)
>> at org.mortbay.thread.BoundedThreadPool
>> $PoolThread.run(BoundedThreadPool.java:450)
>>
>>
>> Can you help me? Where am I wrong?
>> Thank you very much!
>> Daniele
>>
>> ---------------------------------------------------------------------
>> ----
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________ Jetty-support  
>> mailing list [hidden email] https://
>> lists.sourceforge.net/lists/listinfo/jetty-support
>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support