Trying to call Prince from a PHP script. The Prince class instantiation apparently works - didn't throw an error - but any calls to the class to do something fail. The code is
and can be executed at http://www.fearringtonfha.org/code/printToPDF.php.
I have checked paths on my server and they look OK. The prince shell script seems to correctly point to the Prince binary, and both the calling script and the binary have 755 permissions. Also, the prince_error.log file is in the site's public_html directory, and has permissions of 666.
Looking for suggestions about where to look and what to do to get this running.
Thanks.
<?php
//header('Content-Type: application/pdf');
//header('Content-Disposition: inline; filename="file.pdf"');
/*
* Program: printToPDF.php
*
* Function: Displays an HTML page rendered into PDF by the Prince program
*
* Arguments are passed as a querystring:
*
* input=file.html
* css=cssfile.css (optional. Joomla templates will always be loaded ahead of this one.)
*
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/code/prince-php/prince.php";
$prince = new Prince('/usr/prince');
if(!$prince) die("<p>Prince instantiation failed</p>");
else echo "Prince instantiation OK<br />";
echo("<p>Server Document Root = " . $_SERVER['DOCUMENT_ROOT'] . "</p>");
$logLoc = $_SERVER['DOCUMENT_ROOT'] . '/prince_error.log';
echo("<p>Log file to $logLoc</p>");
if(!$prince->setLog($logLoc))die("<p>Error setting error log to $logLoc</p>");
$xmlString="<h1>Hello World</h1><p>This is a test. Did you guess?</p>";
if(!$prince->convert_string_to_passthru($xmlString))die("Error running Prince");
?>
and can be executed at http://www.fearringtonfha.org/code/printToPDF.php.
I have checked paths on my server and they look OK. The prince shell script seems to correctly point to the Prince binary, and both the calling script and the binary have 755 permissions. Also, the prince_error.log file is in the site's public_html directory, and has permissions of 666.
Looking for suggestions about where to look and what to do to get this running.
Thanks.