exec() vs shell_exec()

Posted on 2009-02-24
Medium Priority
Last Modified: 2012-05-06
What are the differnces between exec() vs shell_exec() in PHP?
Question by:hankknight
  • 2
LVL 14

Expert Comment

by:Ionut A. Tudor
ID: 23723677
excerpt from php manual:
exec  Execute an external program http://www.php.net/manual/en/function.exec.php
shell_exec  Execute command via shell and return the complete output as a string http://www.php.net/manual/en/function.shell-exec.php
So maybe you can explain what exactly you need to achieve so we can advice the way you should proceed.
LVL 16

Author Comment

ID: 23733017
All I need to do is resize an image using ImageMagick.

convert -size 240x180 image.jpg -thumbnail 120x90 thumb.gif

Open in new window

LVL 14

Accepted Solution

Ionut A. Tudor earned 2000 total points
ID: 23733035
Then use exec() to access that program.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

839 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