Running ffmpeg from php. Getting sh: 1: ffmpeg: not found

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Running ffmpeg from php. Getting sh: 1: ffmpeg: not found

Postby alexstyl » 27. August 2021 16:53

I am trying to execute ffmpeg from php. I have installed ffmpeg locally on my mac via homebrew and I am able to run the commands I need via terminal.

When I try to execute the following code:
Code: Select all
<?php
    echo "Starting ffmpeg";
    $output = shell_exec("ffmpeg -i test.mp3 -codec:a libmp3lame -b:a 128k out.mp3 2>&1");
    echo "<pre>$output</pre>";
?>


I am receiving the following on my browser:

Starting ffmpeg

sh: 1: ffmpeg: not found


I am assuming that I somehow need to install ffmpeg to my xampp server but it is not obvious how to do that. After searching online I can find linux and Windows tutorials but I couldn't figure out something out by looking at them.

What I tried doing was to download the ffmpeg static build form https://ffmpeg.org/download.html#build-mac and placed it in the htdocs holder, and then tried to execute ffmpeg as if it was an executable (after changing chmod), but still no luck.

How would one go and install and then run ffmpeg on their xampp server?
alexstyl
 
Posts: 2
Joined: 27. August 2021 16:43
XAMPP version: 8.0.9
Operating System: Mac OS 11.5.2

Re: Running ffmpeg from php. Getting sh: 1: ffmpeg: not foun

Postby alexstyl » 28. August 2021 10:34

I realised that the apache server that xampp starts is a debian instance. I was using the wrong static build (mac instead of debian one). Downloading and using the debian one resolved my issue.
alexstyl
 
Posts: 2
Joined: 27. August 2021 16:43
XAMPP version: 8.0.9
Operating System: Mac OS 11.5.2


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 9 guests