Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:


Go Back   Caucho Forums > Quercus

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2013, 04:16 PM
arvind_cits arvind_cits is offline
Junior Member
 
Join Date: Mar 2013
Posts: 4
Post Quercus newbie- Some issues on using Quercus with Tomcat

Hi

I wish to use Quercus+ Tomcat to run some PHP code.

I have the following queries-

(1) How do I connect to any database, viz SQL Server/Oracle/MySQL/PostGRESQL/others? The Quercus+Resin page mentions that PDO can be used (in PHP code) and JDBC driver corresponding to the chosen database has to be included- however this information is given for Quercus+Resin.... How do I use any database in PHP code when the PHP code is run using Quercus + Tomcat? And what all PHP frameworks can be used for database access (for eg. PDO) when running PHP code under Tomcat+Quercus

(2) How do I specify a custom PHP.INI when running PHP code under Quercus+Tomcat?

(3) How do I add support for popular PHP modules to my Quercus+Tomcat install? So that those PHP modules can be used out-of-the-box in my Quercus+Tomcat installation?

(4) The quercus+tomcat page mentions that mail.jar can be used--how do I use this from directly within PHP Code? Actually I would prefer using PHP's mail function-- is that supported as it is in Tomcat+Quercus?

(5) Finally do you recommend some other Java server over tomcat due to performance/other issues? Which such server do you recommend and why?

Thanks,
Arvind.
Reply With Quote
  #2  
Old 03-09-2013, 08:44 PM
adam adam is offline
Member
 
Join Date: Oct 2009
Posts: 31
Default

I am no quercus expert, but I use Quercus+Tomcat with few issues

Here are some thoughts:

1) Make sure your .jar files for the database are in your tomcat lib folder. I know mysql works fine for this and you can use the php mysql/i with no problem. I also use H2 database with no issues. I have not tried other databases.

2)... never done this. I set my quercus config as parameters in my web.xml.

4) just put mail.jar and (I think) activation.jar in your tomcat lib folder. Php mailing functions work fine with Quercus (at least what I have tested).

5) Quercus works well with tomcat. I have used it on a site that has been up for quite some time and I have ran into no performance issues. I am now exploring resin as a tomcat alternative, but I am not knowledge about resin. For increased performance you can get a key to compile quercus to java (as opposed to interpret). This will work with tomcat also. It is $99 a year, but you can contact sales and likely get a trial.
Reply With Quote
  #3  
Old 03-10-2013, 09:44 AM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

Thanks adam for helping out.

Hi arvind_cits, to answer your questions:

Quote:
(1) How do I connect to any database, viz SQL Server/Oracle/MySQL/PostGRESQL/others? The Quercus+Resin page mentions that PDO can be used (in PHP code) and JDBC driver corresponding to the chosen database has to be included- however this information is given for Quercus+Resin.... How do I use any database in PHP code when the PHP code is run using Quercus + Tomcat? And what all PHP frameworks can be used for database access (for eg. PDO) when running PHP code under Tomcat+Quercus
As long as you have the JDBC drivers, you can use mysql, oracle, and postgresql without having to do any configuration. Or you can use JNDI via PDO to connect to your databases. For SQL Server, you'll need to use JNDI because Quercus doesn't natively support it yet. Let me know if you need further assistance.

Quote:
(2) How do I specify a custom PHP.INI when running PHP code under Quercus+Tomcat?
In your web.xml, you can specify the path to your php.ini file:

<servlet>
<servlet-name>Quercus Servlet</servlet-name>
<servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
<init-param>
<param-name>ini-file</param-name>
<param-value>WEB-INF/php.ini</param-value>
</init-param>
...

Quote:
(3) How do I add support for popular PHP modules to my Quercus+Tomcat install? So that those PHP modules can be used out-of-the-box in my Quercus+Tomcat installation?
Quercus does not support PHP modules that are written in C. But if they are written in pure PHP, they should work if you "include()" them in your script.

For example, you can set your ini include_path to your library path. Them in your PHP script,

require_once("my_library.php&quot;

It'll be nice if Quercus automatically includes libraries in a specific path, is that what you're looking for?

Quote:
(4) The quercus+tomcat page mentions that mail.jar can be used--how do I use this from directly within PHP Code? Actually I would prefer using PHP's mail function-- is that supported as it is in Tomcat+Quercus?
If mail.jar is in your classpath (WEB-INF/lib directory), then you can use PHP's mail() function.

Quote:
(5) Finally do you recommend some other Java server over tomcat due to performance/other issues? Which such server do you recommend and why?
I would recommend Resin, because that is what we test Quercus on. And Quercus Pro on Resin supports distributed sessions.
Reply With Quote
  #4  
Old 03-11-2013, 01:28 AM
arvind_cits arvind_cits is offline
Junior Member
 
Join Date: Mar 2013
Posts: 4
Post Couple more questions

Hi

If I use Quercus with Tomcat can I use it to run my proprietary (closed source) software? That is really important for me.

Another issue is that I will most likely need to use SQL Server as well- how do I use that in the PHP code-- you have mentioned JNDI-- but what is the syntax/logic of the commands I will have to give in the PHP code so that a SQL Server database can be accessed?

Also ability to run PHP modules within a specified folder would be a definte requirement for me. How do I do that?

Also, can I develop any PHP modules that are currently not supported by Quercus, and make them work simply by ensuring that they are coded purely in PHP? ( And by ensuring that the original PHP module which I want to be able to use--> that module's entire functionality is replicated in my PHP coded module?)

Thanks,
Arvind.
Reply With Quote
  #5  
Old 03-11-2013, 05:23 AM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

Quote:
If I use Quercus with Tomcat can I use it to run my proprietary (closed source) software? That is really important for me.
You can use Quercus Open Source for your proprietary apps. But if you choose to distribute your apps publicly, then you'll need to also distribute your sources because Quercus is GPL-licensed.

Quote:
Another issue is that I will most likely need to use SQL Server as well- how do I use that in the PHP code-- you have mentioned JNDI-- but what is the syntax/logic of the commands I will have to give in the PHP code so that a SQL Server database can be accessed?
See http://www.caucho.com/resin-3.1/doc/....xtp#databases. You'll first need to configure JNDI for your database on your app server (Resin, Tomcat, Jetty, etc.).

Quote:
Also ability to run PHP modules within a specified folder would be a definte requirement for me. How do I do that?
I don't think this is supported yet. I've filed a bug report at http://bugs.caucho.com/view.php?id=5390.

Quote:
Also, can I develop any PHP modules that are currently not supported by Quercus, and make them work simply by ensuring that they are coded purely in PHP? ( And by ensuring that the original PHP module which I want to be able to use--> that module's entire functionality is replicated in my PHP coded module?)
As a workaround, you can manually "include" the modules you need in your scripts:

Code:
<?php

require_once("my_module.php");

?>
Reply With Quote
  #6  
Old 03-11-2013, 07:19 AM
arvind_cits arvind_cits is offline
Junior Member
 
Join Date: Mar 2013
Posts: 4
Post With ref to using Quercus in closed source apps

Hello again,

I have one final query--- I plan to create a software-as-a-service product where I want to use Quercus-- now the Software which uses Quercus will be installed and made available to the user- however he will be able to access the API of that software(This software will use Quercus).

In this scenario, can I use the GPL licensed Quercus without needing to reveal source code to my end users.

Thanks,
Arvind.
Reply With Quote
  #7  
Old 03-15-2013, 04:19 PM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

Hi Arvind,

If it's a web service hosted on your own servers, then I believe you do not need to distribute your source. But if the software is to be installed on users' machines, then I believe you'll need to distribute your source.

Nevertheless, please contact sales@caucho.com for clarification. If you do need licensing, I think they can work something out with you for your special case.
Reply With Quote
Reply

Tags
java, php, quercus, tomcat

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:51 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.