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
Solved

How do I get htmldoc to execute using PHP exec?

Posted on 2009-07-03
10
438 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

789 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