Hello,
I am very new to Prince xml and have recently had Prince 8.0 installed onto my Linux Centos 5.7 server with Apache 2.3 and PHP 5.3.8 through the hosting company with all dependencies. It has been installed and is available at /usr/lib/prince/bin/prince on the server. Msttcorefonts, chkfontconfig, libgif, and cabextract have been installed also.
The program runs correctly through command line, but something seems to be preventing it from being called through PHP;
I have Atomic Secured Linux on the server. I have went through each php function in prince.php to make sure it was allowed on ASL.
http://mrbconline.org/new_prince/test4.php is my testing php code:
The log file is http://mrbconline.org/new_prince/prince_error.log
I requested help from my host and this was their response:
I actually still cannot get anything to write to prince_error.log like this host support did.
I have been trying to get Prince to run through PHP for a few weeks now, fixing what I could through your great forum. I would love some help on this issue.
Take Care,
Doug
I am very new to Prince xml and have recently had Prince 8.0 installed onto my Linux Centos 5.7 server with Apache 2.3 and PHP 5.3.8 through the hosting company with all dependencies. It has been installed and is available at /usr/lib/prince/bin/prince on the server. Msttcorefonts, chkfontconfig, libgif, and cabextract have been installed also.
The program runs correctly through command line, but something seems to be preventing it from being called through PHP;
I have Atomic Secured Linux on the server. I have went through each php function in prince.php to make sure it was allowed on ASL.
http://mrbconline.org/new_prince/test4.php is my testing php code:
<?php
//header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="file.pdf"');
?>
</head>
<body>
<?php
require "prince.php";
$prince = new Prince('/usr/lib/prince/bin/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'] . '/new_prince/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");
convert_string_to_passthru($xmlString);
?>
The log file is http://mrbconline.org/new_prince/prince_error.log
I requested help from my host and this was their response:
We have manually set the permissions on the log file, allowing both your site user and apache to write to it.
Hi, am not a php expert to troubleshoot this issue through to a resolution. The php scripts appear to be executed as 'apache' uid. I have tested and can confirm that both 'apache' and 'mrbconline' are able to write to that logfile. I have made the .php echo some lines into the logfile and that worked successfully as well. The linked test4.php script appears to be calling a function that attempts to set a variable. This variable is properly set but the script thinks that it has failed. I am able to make the script realize it did not fail by adding a 'return 1' to the setLog function in prince.php.
After this issue the script appears to attempt to convert a file as a test. It is claiming that this test fails. The prince_error.log shows the following:
Fri Feb 10 01:47:46 2012: Loading document...
Fri Feb 10 01:47:46 2012: -:1: error: Extra content at the end of the document
Fri Feb 10 01:47:46 2012: -: error: could not load input file
Fri Feb 10 01:47:46 2012: error: no input documents to process
Fri Feb 10 01:47:46 2012: finished: failure
Fri Feb 10 01:47:46 2012: ---- end
The function that is called for this is convert_string_to_passthru which calls it with a line of text as an argument. This function appears to be expecting a path to a file instead. As a result I believe these tests failing are issues with the php coding but I cannot spend much time debugging a test script.
Best Regards,
I actually still cannot get anything to write to prince_error.log like this host support did.
I have been trying to get Prince to run through PHP for a few weeks now, fixing what I could through your great forum. I would love some help on this issue.
Take Care,
Doug