php-windows Digest 15 Jun 2004 09:17:12 -0000 Issue 2284

Topics (messages 23977 through 23980):

Realpath in pdflib & apache2
        23977 by: Claus

executing a java app from a php script
        23978 by: George Pitcher
        23979 by: Frank M. Kromann
        23980 by: George Pitcher

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
When creating a pdf file using pdflib through php on Apache2, I have 
noticed that the default path for the filenames are different depending 
on where the filename is used.

I wanted to open a template pdf file to save time by having all constant 
texts generated only once and reuse the template later.

I am using something like this:

$filename= "template.pdf";
if (file_exists($filename)) {
  // Use template file
  $form = pdf_open_pdi($pdf, $filename, "", 0);
    if ($form == 0){
      die("Error: " . PDF_get_errmsg($pdf));
    }

   ...
   ...

} else {
  // No template, generate it
  ...
  ...
}

My problem is that I get an error message when pdflib tries to open the 
file. 

A template.pdf is located at c:/web/htdocs, which is the apache 
configuration for DocumentRoot.

The problem is that pdflib looks for the template.pdf where the apache 
setting for ServerRoot is pointing, which is somewhere different. 

Obviously I can change DocumentRoot and the ServerRoot to resolve this, 
but I find that the location of apache binaries, logs, etc. and my web-
site are two different issues and should not be mixed.

The solution I have found is the use realpath() to resolve filenames to 
fully qualified names, e.g. $filename= realpath("template.pdf").

Is this the best way of doing this?

--- End Message ---
--- Begin Message ---
Hi,

I'm trying to do a bit of java execution as part of a php routine and the
following just doesn't work:

<?php
$cover = "c:\\javatest\\44438.pdf";
$cover_fin = "c:\\javatest\\44438_fin.pdf";
$cover_enc = "c:\\javatest\\44438_enc.pdf";
$docname = "c:\\javatest\\Lovejoy1.pdf";

$cmd = "java -cp C:\\j2sdk1.4.2_04\\jre\\lib\\itext.jar
com.lowagie.tools.concat_pdf ".$cover." ".$docname." ".$cover_fin;
$temp = passthru($cmd);
?>

Even adding tha path to 'java' doesn't help.

This command works fine from the command line. It adds two pdf files
together. If I can get this to work, I'll also add the encryption routine.

Any ideas


George in Oxford

--- End Message ---
--- Begin Message ---
It could be a problem with access to execute Java. If the user running the
process (under a web server) is without rights to execute this will not
work.

You can try running the script with CLI from the command line or you can
take a look at the java extension for PHP (www.php.net/java).

- Frank

> Hi,
> 
> I'm trying to do a bit of java execution as part of a php routine and
the
> following just doesn't work:
> 
> <?php
> $cover = "c:\\javatest\\44438.pdf";
> $cover_fin = "c:\\javatest\\44438_fin.pdf";
> $cover_enc = "c:\\javatest\\44438_enc.pdf";
> $docname = "c:\\javatest\\Lovejoy1.pdf";
> 
> $cmd = "java -cp C:\\j2sdk1.4.2_04\\jre\\lib\\itext.jar
> com.lowagie.tools.concat_pdf ".$cover." ".$docname." ".$cover_fin;
> $temp = passthru($cmd);
> ?>
> 
> Even adding tha path to 'java' doesn't help.
> 
> This command works fine from the command line. It adds two pdf files
> together. If I can get this to work, I'll also add the encryption
routine.
> 
> Any ideas
> 
> 
> George in Oxford
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Frank,

This script is only ever going to be used by me, but I'd like to avoid the
command line.

I've checked the permissions and there's no problem there.

I've now gone the extra step of having the java command written to a batch
file and then I try and exec{} or passthru{} the batch file but with the
same negative result as before.

Any suggestions?

Cheers

George

> -----Original Message-----
> From: Frank M. Kromann [mailto:[EMAIL PROTECTED]
> Sent: 14 June 2004 6:00 pm
> To: George Pitcher
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] executing a java app from a php script
>
>
> It could be a problem with access to execute Java. If the user running the
> process (under a web server) is without rights to execute this will not
> work.
>
> You can try running the script with CLI from the command line or you can
> take a look at the java extension for PHP (www.php.net/java).
>
> - Frank
>
> > Hi,
> >
> > I'm trying to do a bit of java execution as part of a php routine and
> the
> > following just doesn't work:
> >
> > <?php
> > $cover = "c:\\javatest\\44438.pdf";
> > $cover_fin = "c:\\javatest\\44438_fin.pdf";
> > $cover_enc = "c:\\javatest\\44438_enc.pdf";
> > $docname = "c:\\javatest\\Lovejoy1.pdf";
> >
> > $cmd = "java -cp C:\\j2sdk1.4.2_04\\jre\\lib\\itext.jar
> > com.lowagie.tools.concat_pdf ".$cover." ".$docname." ".$cover_fin;
> > $temp = passthru($cmd);
> > ?>
> >
> > Even adding tha path to 'java' doesn't help.
> >
> > This command works fine from the command line. It adds two pdf files
> > together. If I can get this to work, I'll also add the encryption
> routine.
> >
> > Any ideas
> >
> >
> > George in Oxford
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to