Jump to content

exec()


timmah1

Recommended Posts

Following tutorials to upload and convert video files to flv, I'm running into an error

Warning: exec() has been disabled for security reasons in /home/public_html/uploadvideo.php on line 47

Warning: exec() has been disabled for security reasons in /home/public_html/uploadvideo.php on line 51

Line 47 is this:

if( $fileExtension == "avi" || $fileExtension == "mpg" || $fileExtension == "mpeg" || $fileExtension == "mov" ) {
//LINE 47 -->exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName."-sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");
}

Line 51 is this:

LINE 51--> exec("ffmpeg -y -i ".$dynamic_path."/".$moviepath."".$fileName."-vframes 1 -ss 00:00:03 -an -vcodec png -f rawvideo -s 110x90 ".$dynamic_path."/".$flvpath."myflv.png");
}

 

Here is the code

<?php
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;

// load extension
if (!extension_loaded($extension)) {
dl($extension_soname) or die("Can't load extension $extension_fullname\n");
}

$array_path = explode("/",$_SERVER['SCRIPT_FILENAME']);
$dynamic_path = "";
for ($i=0;$i<sizeof($array_path)-1;$i++)
if($array_path[$i]!="")
$dynamic_path =$dynamic_path."/".$array_path[$i];

$flvpath = "flvfiles/";
$moviepath = "movies/" ;
chmod($moviepath,0777);
chmod($flvpath,0777);

if(isset($_FILES["x_URL"]))
{
$fileName = $_FILES["x_URL"]["name"];
$fileNameParts = explode( ".", $fileName );
$fileExtension = end( $fileNameParts );
$fileExtension = strtolower( $fileExtension );
if($fileExtension=="avi" || $fileExtension=="wmv" || $fileExtension=="mpeg" || $fileExtension=="mpg" || $fileExtension=="mov" )
{
if ( move_uploaded_file($_FILES["x_URL"]["tmp_name"],$moviepath.$_FILES["x_URL"]["name"])
)
{

if( $fileExtension == "wmv" ) {
exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName."-sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");
}

if( $fileExtension == "avi" || $fileExtension == "mpg" || $fileExtension == "mpeg" || $fileExtension == "mov" ) {
LINE 47--> exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName."-sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");
}


LINE 51--> exec("ffmpeg -y -i ".$dynamic_path."/".$moviepath."".$fileName."-vframes 1 -ss 00:00:03 -an -vcodec png -f rawvideo -s 110x90 ".$dynamic_path."/".$flvpath."myflv.png");
}
else
{
die("The file was not uploaded");
}
}
else
{
die("Please upload file only with avi, wmv, mov or mpg extension!");
}
}
else
{
die("File not found");
}
?>

 

Can anybody see what the problem might be?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/167524-exec/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.