2

Forgive me if I make any mistakes as this is my first time posting a question.

I'm working on a web app that uses the Resin Embedded Libraries -- It depends heavily on the PHP Engine (Quercus) that is included with Resin. After 3 days of coding I decided it was time to make my first runnable jar for testing on my web server when I came across a strange problem with Quercus -- I assume. Basic PHP Functions such as date, count and var_dump were returning as unknown functions when they were called from the PHP File I requested from the server.

But from within my IDE (Eclipse 3.8) I had no problems what so ever. So going back to the first doc I used, I made a small test app using the bare minimum code and libraries. I followed the instructions for the first tutorial at http://www.caucho.com/resin-3.1/doc/resin-embedding.xtp and I seem too get the exact problem as before.

The main code from the test app

public class Main
{
    public static void main( String[] args )
    {
        ResinEmbed resin = new ResinEmbed();

        HttpEmbed http = new HttpEmbed( 8080 );
        resin.addPort( http );

        WebAppEmbed webapp = new WebAppEmbed( "/", "/var/www" );

        resin.addWebApp( webapp );

        resin.start();
        resin.join();
    }
}

The PHP file I used for testing

<?php var_dump( "Hello World" ); echo date("Y"); ?>

The Exception

com.caucho.quercus.QuercusErrorException: 'date' is an unknown function.
        at com.caucho.quercus.env.Env.error(Env.java:6885)
        at com.caucho.quercus.env.Env.error(Env.java:6408)
        at com.caucho.quercus.expr.CallExpr.evalImpl(CallExpr.java:188)
        at com.caucho.quercus.expr.CallExpr.eval(CallExpr.java:141)
        at com.caucho.quercus.statement.EchoStatement.execute(EchoStatement.java:55)
        at com.caucho.quercus.statement.BlockStatement.execute(BlockStatement.java:105)
        at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:414)
        at com.caucho.quercus.env.Env.evalCode(Env.java:4201)

So I know my issue is not something in my code and I tried playing with project properties and different library versions with no luck. Right now, I'm using the latest version of 4.0.36 with Java version 1.7_25. I've even tried it on multiple computers (All running Linux, since thats all I use now a days). I've been up and down the internet looking for help but no existing threads seemed to even come close to my problem. Would anyone know what would cause this? I hope my question was detailed enough without being too long or too detailed.

If interested, I can also post the repository for my app but the code above gets the same problem as my app even though my app and the example above executes the code in slightly different manners.

UPDATE:

After extensively searching and testing the source for Quercus, I discovered that the problem seems related to not all the modules loading -- ie. Modules add the missing functions -- So I discovered that if I export my project with the option "Copy required libraries into a sub-folder next to the generated JAR" it works just as it does in the IDE. Now, As this is at least a temporary solution to get my project running, I would still like to know how to compile as normal without getting the problem. (58 modules loaded inside the IDE, Only 2 loaded when compiled.)

  • +1: Looks like a well done first question, especially as this is not a common topic. – hakre Aug 27 '13 at 23:15
  • Thank You, I really tried. I just hope someone can help me. – Ms. Amelia S. Greene Aug 27 '13 at 23:21
  • I'd say you need to have some patience because there are not so many resin/quercus users. In the meanwhile, browse existing questions of these tags and take a look if there are unanswered questions or you can leave better answers. – hakre Aug 27 '13 at 23:27
  • I know it might not get answered right away, I'm just going crazy since I've been banging my head on my keyboard for the last day over this issue. I guess I should contribute my time to helping others in exchange for how many times Stack Overflow has helped me. – Ms. Amelia S. Greene Aug 27 '13 at 23:33
  • Not only that, it can also inspire and give you some distraction for your own problem so you can re-approach it fresh again later / next day. Sometimes it's good to give a problem some rest. – hakre Aug 27 '13 at 23:35
  • Just seeing your update. Are you able to find out (e.g. in some logs) how the IDE compiles (e.g. all parameters, working directory, environment variables and stuff)? That might give additional hints. – hakre Aug 28 '13 at 11:52
  • Well interestingly, I've found more then enough to convince me that the Resin/Quercus community to pretty much dead. I first decided to switch back to Jetty as my Embedded Web Server but this was soon greeted with the above problem even being found inside of my IDE, So I concluded that the only reason it was working was because of something inside the Resin web server that I'm no longer using. So after much reasoning and consideration, I'm switching to Jetty and using Groovy as my dynamic language. At least all my work did not go to waste since I can still make Groovy work like PHP but better. – Ms. Amelia S. Greene Oct 13 '13 at 07:38
  • That can be as one larger part PHP core is about the SAPI interfacing, something that a Java based HTTP client must also deal with to compile and run common PHP code. I'm not affiliated with Resin/Quercus and I don't have much insight what kind of activity it currently has and what potential plans are. I always thought it's quite some interesting project but time does not stand still. – hakre Oct 13 '13 at 10:05

0 Answers0