0

I have a PHP script that runs this command:

system("pdftohtml -i -noframes /home/myacc/pdfs/test.pdf");

When I run this from within public_html, an html file called test.html is successfully created and is placed in the public_html folder. However, when I run this from a cron job outside of public_html, no html file is created in any folder on the server.

Can anyone help me find where the resulting html file will be?

Thank you.

4
  • No. - Does the PHP script have permission to write in the current directory? Checked the error.log yet? Why don't you just specify the output filename? Commented Oct 31, 2011 at 14:27
  • The easiest thing you could do is mapping your server (built in option if you use windows 7, otherwise use netdrive) and then you'll be able to search for files in the server just as you search for files in a local drive. Anyway, I'd recommend you to post the full - most of times it helps to solve the problem Commented Oct 31, 2011 at 14:27
  • @mario as far as i can see, i can't specify the output filename using pdftohtml - it will always output the html file in the working directory. The problem is where is the working directory if the script is being run as a cron job? i have checked the permissions, they are fine and there is no error log being created, so it must be somewhere. Commented Oct 31, 2011 at 14:31
  • It's pdftohtml input.pdf output.html as per the manpage. And of course specifying the cron job directory instead of relying on unspecified values (either /tmp or $HOME) would be sound. tinyurl.com/5wannzg Commented Oct 31, 2011 at 14:53

1 Answer 1

1

The problem lies in how cronjob work. Try to use the absolute location to pdftohtml.

Also, from your comment, you can't change how pdftohtml write the output. However, there's a trick to workaround this. That is by using custom shell script:

#!/bin/bash
cd /path/to/output/
/path/to/pdftohtml -i -noframes /home/myacc/pdfs/test.pdf
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for your reply. I understand the logic is to change the directory to the path to output, but can you clarify how I would do this in a PHP script? Could I do: system("cd /path/to/output/")?
hmm... if you insist on using system(), I think the proper way is: system("cd /path/to/output/;/path/to/pdftohtml -i -noframes /home/myacc/pdfs/test.pdf");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.