How to run linux commands in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ramakrishnankt
Forum Newbie
Posts: 1
Joined: Sat Jul 18, 2009 2:07 am

How to run linux commands in php

Post by ramakrishnankt »

Hi,
I installed poppler utils for converting pdftohtml, it works well in terminal by the command
pdftohtml -c Desktop/resume.pdf
But in a php program
echo exec('pdftohtml -c Desktop/resume.pdf');
this is not works why
Thanks
Ramakrishnan
FrancineSantos
Forum Newbie
Posts: 1
Joined: Mon Nov 23, 2009 11:28 pm

Re: How to run linux commands in php

Post by FrancineSantos »

Hmmm anyone can help? hehe
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: How to run linux commands in php

Post by AbraCadaver »

Several possibilities (maybe all):

1. pdftohtml is not in the path so you need the full path (/usr/bin/pdftohtml)
2. pdftohtml can't find Desktop/resume.pdf so you need the full path (/home/user/Desktop/resume.pdf)
3. Does the PHP user have permissions to read the PDF and write the HTML to the location?

-Shawn
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply