Jump to content

Need Help with executing this code in php..! urgent.. help plz.


dawg00

Recommended Posts

The following code is working in the command line(have installed xpdf)

#pdftotext /var/www/kweb/a.pdf /var/www/kweb/testFile.txt

 

but when i try to run it with this code in php file its not working

 

<?php

$file=$_POST['file1'];

echo $file;

 

exec ("pdftotext $file '/var/www/kweb/testFile.txt' "); //line not executing

exec ("tr -d '\012' < '/var/www/kweb/testFile.txt' > '/var/www/kweb/tf.txt' ");

php?>

 

 

Plz help me, it urgent..

THnaks a lot

When you run the script via a web site, the user it's running under is usually "apache" or "nobody" and this user may not have this command in it's path. Put the fully qualified path in the command.

 

Ken

//tried even this  :'(

//did not work :'(

<?php

 

$file="/var/www/kweb/a.pdf";//full path

 

exec ("pdftotext $file /var/www/kweb/testFile.txt ");

 

exec ("tr -d '\012' < '/var/www/kweb/testFile.txt' > '/var/www/kweb/tf.txt' ");

 

php?>

 

Change

<?php
exec ("pdftotext $file '/var/www/kweb/testFile.txt' ")
?>

to

<?php
exec ("pdftotext $file '/var/www/kweb/testFile.txt' ", $output, $ret);
?>

and see if any errors are returned in the $output variable.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.