Solved

How do I get htmldoc to execute using PHP exec?

Posted on 2009-07-03
10
437 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

770 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