Help - Search - Member List - Calendar
Full Version: execute bash command with php script
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
Steve Turnbull
Hi

Could someone tell me how to execute a linux shell command with PHP? I am
using PHP as a bash script and want to issue the command;

convert -sample 25%x25% $img thumb.$img

It is just a simple script to convert jpg's into thumbnails and I am more
at home with PHP than bash...

Thanks
Steve

Veikko Mkinen
Steve Turnbull wrote:
QUOTE
Hi

Could someone tell me how to execute a linux shell command with PHP?

http://www.php.net/manual/en/ref.exec.php
eg. exec("convert -sample 25%x25% $img thumb.$img");

But these functions are often disabled on public servers and you should
also be aware that the command might be executed by the user running the
web server (running PHP as CGI or with suexec wrapper is the cure for this).


-veikko

--
veikko
mail@ .com
makinen

Steve Turnbull
On Wed, 22 Jun 2005 16:45:21 +0300, Veikko Mkinen wrote:

QUOTE
Steve Turnbull wrote:
Hi

Could someone tell me how to execute a linux shell command with PHP?

http://www.php.net/manual/en/ref.exec.php
eg. exec("convert -sample 25%x25% $img thumb.$img");

But these functions are often disabled on public servers and you should
also be aware that the command might be executed by the user running the
web server (running PHP as CGI or with suexec wrapper is the cure for this).


-veikko
Thanks for the reply


I have CGI installed in my PHP, how would I go about executing a command
from within there? Could you elaborate please?

Thanks
Steve


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2005 Invision Power Services, Inc.