I am not able to make PHPGenerator work but maybe you will see some mistake in
my actions:
1. I have downloaded PHP 4.2.3 Win32 binaries from PHP site 
2. I have enabled php_java extension and setup [Java] section like this:
[Java]
java.class.path = c:\DevTools\php-4.2.3-Win32\extensions\php_java.jar
java.home = c:\DevTools\jdk1.3.1_06 
java.library = c:\DevTools\jdk1.3.1_06\jre\bin\hotspot\jvm.dll 
java.library.path = c:\DevTools\php-4.2.3-Win32\extensions\

3. I have downloaded phpsrvlt.jar from somewhere (the original from PHP
binaries did not contain net.php.servlet class and I was not able to compile
PHP by myself due to some compilation errors)

4. I have put phpsrvlt.jar int lib/optional dir of cocoon sources (today's
snapshot) and updated jars.xml

5. I have built cocoon (scratchpad war)

6. Set up some environment variables (do not even remember which ones)

7. started tomcat (4.1.12)

8. opened cocoon to see if it works

9. added the sitemap entry:
    <map:match pattern="test.php">
               <map:generate type="php" src="documents/test.php"/>
               <map:serialize type="xml"/>
        </map:match>
10.  created a simple php file:
<?php 

   print "<?xml version=\"1.0\"?>\n";

   print "<page>\n";
   print "<title>Hello world from PHP</title>\n";
   print "<content>\n";
   print "<para>This is my page being dynamically generated using a 
PhpGenerator</para>\n";
   print "</content>\n";
   print "</page>\n";
?>

11. run http://localhost:8080/cocoon/test.php

And I get the following error: 
"Function registration failed - duplicate name - java_last_exception_get"
"Function registration failed - duplicate name - java_last_exception_clear"
"java: Unable to register functions, unable to load"

I have figured out that if I disable php_java.dll extension ( and [Java]
section) this error does not occur but still happens what follows:

org.apache.cocoon.ProcessingException: org.xml.sax.SAXParseException: Premature end of 
file.: null:-1:-1:org.xml.sax.SAXParseException: Premature end of file.
        at org.apache.cocoon.generation.PhpGenerator.generate(PhpGenerator.java:198)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:512)
        at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:204)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:483)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:149)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:85)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:166)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:109)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:153)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:109)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:143)
        at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:326)
        at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:308)
        at org.apache.cocoon.Cocoon.process(Cocoon.java:596)

What is really funny, when i look into tomcat's console window I see:
<?xml version="1.0"?>
<page>
<title>Hello world from PHP</title>
<content>
<para>This is my page being dynamically generated using a PhpGenerator</para>
</content>
</page>

Configuration summary:
Windows 2000
JDK 1.3.1 06
xml-cocoon2_20021118112152.tar.gz
php 4.2.3
phpsrvlt.jar from "somewhere" :) (got the link :
http://www.9753.net/download/server/php/java/ )

Has anyone got this error before?

I thought that PHP Generator would be quite useful when dealing with databases
that do have ODBC and do not have JDBC (still I'm trying to figure out how to
access Pervasive 7 from cocoon)

but questions are coming:
1. What about request parameters? Will they be visible in php code?
2. How could I access user session data?
3. What to do if php code generates an error ? I'm almost sure that this would
lead to non well formed xml document
        ouzo
        
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      [EMAIL PROTECTED]          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to