problem with exec command
Moderator: General Moderators
problem with exec command
Im using the exec command to use image magick tools to create thumbnails (need something more robust than GD). PHP generates the command, which will work if I copy and paste the generated command and execute it from the terminal. However, it does NOT work when executed from the exec() function in PHP. The function itself returns nothing, and the third parameter which is the return value of the executed command returns 127. There is no cwd issue since i use a full path for the file names. There also shouldnt be any ownership issues since all the folders that these commands are being executed upon are owned by the web server.
PS - I am aware that there is the imagick pecl module, but it is buggy and causes php to act very strangely.
PS - I am aware that there is the imagick pecl module, but it is buggy and causes php to act very strangely.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
feyd wrote:post your code please.
Code: Select all
function imagick_create_thumbnail($image_dir, $image_name, $max_width, $max_height){
$cmd = 'convert ' . $image_dir.$image_name . ' -thumbnail ' . $max_width .'x'. $max_height . ' ' . $image_dir . 'thumb_' . $image_name;
exec($cmd, $somevar, $retval);
return ($retval == 0) ? true : false;
}gonna give gd a shot but now im running into a completely unrelated problem. Trying to compile the gd extension on php but for some reason it relies on x.org... no way am i gonna bother compiling that on a server system that only gets accessed via ssh. I guess ill have to play around with compiling GD to get rid of this stupid dependancy.
ok, was getting the same php wierdness using the gd extension as I was the imagick extension. checked the error log and im getting memory allocation issues. Is there a directive in the php.ini that needs to be increased?
edit:
memory_limit seems like the only directive that would affect this, and its currently set to 8mb...
edit again: doubling this to 16meg fixed it
edit:
memory_limit seems like the only directive that would affect this, and its currently set to 8mb...
edit again: doubling this to 16meg fixed it