Attempting to use 'passthru' or 'exec' function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

I'm trying to output a text file from a pdf file using an external function, 
pdftotext, using either PHP's 'passthru' or 'exec' functions.

The following code sort of works (at least I see localhost busy doing 
something for about three seconds, but  the expected output of 'content.txt' 
is empty. I used an idea found on the mailing list: I actually got some 
activity with 'sudo desired_function arg1 arg2'.

File permissions are set wide open (apache:apache 777), safe_mode=off.

What am I doing wrong? (Btw, the pdftotext function works fine on 
commandline).

<?php

$currentPdf = "2005-01-v2.pdf";
//print "$currentPdf";

if (file_exists($currentPdf)) {
	passthru("sudo /usr/bin/pdftotext /var/www/html/2005-o1-v2.pdf.txt 
/var/www/html//current.txt");
}

/* Also tried the following using 'passthru' then 'exec':
$pdf = file_get_contents($currentPdf);
//print "<br><br>$Pdf";

passthru("sudo pdftotext /var/www/html/2005-o1-v2.pdf.txt 
/var/www/html/current.txt");
*/

$current = "current.txt";

print "<br><br>Current Text: $current";
$string_text = file_get_contents("current.txt");
$new_text = nl2br("$string_text");

?>

Any help, pointers, admonitions gratefully accepted,
Tia,
Andre

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux