9

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! :-)

likeitlikeit
  • 5,563
  • 5
  • 42
  • 56
Ma Jo
  • 111
  • 1
  • 1
  • 3

2 Answers2

15

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.

raidenace
  • 12,789
  • 1
  • 32
  • 35
  • Others execution are working... Only in this code, execution does not working... Sorry for my bad english :) – Ma Jo May 07 '13 at 14:49
  • Like I said, it is because this function has been disabled by the hosting provider, and in shared hosting domain it will be difficult to find a provider who allows exec. If you find someone, be very cautious, because it will not be a really secure or safe server IMHO.. – raidenace May 07 '13 at 14:50
  • @raidenace why does allowing exec on shared hosting be considered not really secure? Could you elaborate more or cite your source please? – Emad Omar Jun 27 '18 at 10:55
3

Those errors mean just what they say.

Fatal error: Call to undefined function execute() 

You are calling a function that doesn't exist.

Warning: exec() has been disabled for security reasons

Your web host has disabled the exec() method, you won't be able to run background scripts (like it appears you are attempting to do). You'll need to find another way to accomplish your goal, or find another web host.