PDA

View Full Version : Quercus without servlet


lotstyl
02-18-2010, 01:37 AM
Hi,

I'm looking for a way to run PHP without using the servlet, but calling the php functions directly from java by passing the source files path and the function name.

Thanks

emil
02-18-2010, 05:12 PM
Hi,

There sure is:

http://wiki.caucho.com/Quercus:_Command_Line_Interface_%28CLI%29


QuercusEngine engine = new QuercusEngine();
engine.executeFile("/var/www/index.php");


You can also use javax.script if you prefer.

Emil

lotstyl
02-19-2010, 03:18 AM
Hi,

thanks for the follow up, i'm actually using Quercus v.4.0-SNAPSHOT with Maven, and no QuercusEngine class exists (but it exists in v.4.0.3).
Is there another way for the maven version (4.0-SNAPSHOT)?

Thanks

nam
02-21-2010, 04:20 AM
Hi,

I'm not sure what the Maven version is at. It's possible that that version does not have a command-line interface or programmatic API.

domdorn
02-21-2010, 11:30 PM
The maven2 snapshots look quite outdated. You should try to checkout the sources and build the snapshot yourself.

lotstyl
08-19-2010, 03:56 AM
But then how can i call a specific function in that file?

Thanks

bogeblad
10-26-2010, 11:24 AM
Emil wrote an example a bit up in this thread:

QuercusEngine engine = new QuercusEngine();
engine.executeFile("/var/www/index.php");

I'm guessing this script (index.php) will not have request/response-objects and other http-related items available unless you expand this a bit? Or is it impossible to invoke a script like this as if it was invoked as a servlet? If possible - do anyone have an example?

Thanx