Solved

How do I get htmldoc to execute using PHP exec?

Posted on 2009-07-03
10
439 Views
Last Modified: 2012-05-07
Hi

I have installed htmldoc and although it works fine from the command line logged in as root it doesn't work from the php exec command.

Is it to do with groups and permissions?

What do I need to do?

Kind Regards,

Adrian Smith
if(exec("htmldoc --webpage --landscape -f output.pdf /var/www/vhosts/web1/httpdocs/results/table.html"))
 
{echo 'Started Background Process';} 
else 
{echo 'Background Process Did Not Start';}

Open in new window

0
Comment
Question by:lwfuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 24772047
Try supplying the full path to htmldoc
0
 

Author Comment

by:lwfuk
ID: 24772113
Hi woolmilkporc

I found the path with #which htmldoc and replaced it as shown below.

Still got the same problem.

Kind Regards



if(exec("/usr/bin/htmldoc --webpage --landscape -f output.pdf /var/www/vhosts/web1/httpdocs/results/table.html"))
 
{echo 'Started Background Process';} 
else 
{echo 'Background Process Did Not Start';}

Open in new window

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24772150
What kind of problem is it? Are there any error messages?
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24772177
... and please supply a (writeable) path to the output file, too.
0
 

Author Comment

by:lwfuk
ID: 24772186
No error messages:

only

{echo 'Background Process Did Not Start';}

and the fact that "output.pdf" does not write.

It works from the command line though and the php page terminates properly.

0
 

Author Comment

by:lwfuk
ID: 24772253
Does this help?
# ls -l /usr/bin/htmldoc
-rwxr-xr-x 1 root root 506246 Oct 29  2008 /usr/bin/htmldoc

Open in new window

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24772267
That's OK. Did you try using a (writeable) path to the outputfile?
0
 

Author Comment

by:lwfuk
ID: 24772284
Yep - I'm using a directory that I upload files to.
0
 

Author Comment

by:lwfuk
ID: 24772364
I found the problem.

1. I needed to add the absolute path to the bin directory.
2. I needed to add the absolute path to the write file. (grrr what a donkey I am)

Anyway woolmilkporc many thanks.

Adrian

PS: I still get the message {echo 'Background Process Did Not Start';} even though it works.
if(exec("/usr/bin/htmldoc --webpage --landscape -f /var/www/vhosts/web1/httpdocs/results/output.pdf /var/www/vhosts/web1/httpdocs/results/table.html"))
 
{echo 'Started Background Process';} 
else 
{echo 'Background Process Did Not Start';}

Open in new window

0
 

Author Closing Comment

by:lwfuk
ID: 31599543
Many Thanks.

Adrian

PS: I also had to add the full path to the output file as well.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question