Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I get htmldoc to execute using PHP exec?

Posted on 2009-07-03
10
Medium Priority
?
449 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 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

609 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