skip to Main Content

I have a strange situation that has just happend. FFMPEG is no longer executing from PHP but will from the command line.

Here is exactly what the command is:

ffmpeg -i ../../uploads/ee78d5deb564901626067cc0008456ed.mp3 -ab 96k -y ../../uploads/mp3/ee78d5deb564901626067cc0008456ed_6203688.mp3

How it is executed in the PHP script:

if(! exec("ffmpeg -i ".$target_path."".$hash_filename.".".$path_extension." -ab 96k -y ".$target_path."mp3/".$hash_filename."_".$session_ID.".mp3")){
    echo 'ffmpeg failed';
}

This command did work but not longer does. I have recently updated plesk but I highly doubt that has affected this. The only thing that I think could affect it that I have recently done is have the file upload go to a subdomain. So the directory where the file is located and stored in the command is in a directory outside the document root. However, the move_uploaded_file function works and I have altered the open_basedir in PHP ini to the webspace root.

2

Answers


  1. tail -f /var/log/apache2/error_log

    and lets us know what you see there…Adjust for your platform…

    this is for lamp (opensuse )

    Login or Signup to reply.
  2. You can try the system() command. It will return you the response from server

    system("ffmpeg -i ".$target_path."".$hash_filename.".".$path_extension." -ab 96k -y ".$target_path."mp3/".$hash_filename."_".$session_ID.".mp3")
    

    if the ffmpeg is not supported with current version of the php it will return you the error.

    OR

    you can modify your command to get ffmpeg with proper path. In my case it works like below code

    exec("/usr/local/bin/ffmpeg -i ".$target_path."".$hash_filename.".".$path_extension." -ab 96k -y ".$target_path."mp3/".$hash_filename."_".$session_ID.".mp3"))
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search