Solved

How do I get htmldoc to execute using PHP exec?

Posted on 2009-07-03
10
433 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
  • 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The viewer will learn how to count occurrences of each item in an array.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now