Warning: `exec()` has been disabled for security reasons

Ma Jo picture Ma Jo · May 7, 2013 · Viewed 36.6k times · Source

I upload a gif to my website. When is upload complete, i can see this error:

Warning: exec() has been disabled for security reasons in /data/web/virtuals/28995/virtual/www/include/functions/main.php on line 306

Fatal error: Call to undefined function execute() in /data/web/virtuals/28995/virtual/www/include/functions/main.php on line 309

And this is part from main.php

$owh = $width_old."x".$height_old;
$nwh = $final_width."x".$final_height;
if(!file_exists($temppic))
{
    $runinbg = "convert ".$file." -coalesce ".$temppic;
    $runconvert = execute("$runinbg");
}
$runinbg = "convert -size ".$owh." ".$temppic." -resize ".$nwh." ".$output;
$runconvert = execute("$runinbg");
return true;

Thank you for help! :-)

Answer

raidenace picture raidenace · May 7, 2013

Just as additional information:

There is a php.ini directive called disable_functions. Functions added to this list will be disabled by PHP and when you try to execute those functions, you get this error. As mentioned, in all probability your hosting provider has added exec to the disabled list. This is a common practice in shared hosting. You will need a dedicated server if you really want to run exec (or some hosting provider who provides pseudo-exec functionality). It is a bad idea to trust a shared hosting provider who allows you to run exec unrestrained.