audio watermark with sox won't work in php

630 views Asked by At

When I am using command line on hosting panel,

sox -m '|sox /home/stockchu/public_html/content/watermark_audio.mp3 -p pad 4 repeat 5' /home/stockchu/public_html/content/sound.mp3 /home/stockchu/public_html/content/sound_watermarked3.mp3

it is working! But when I am do same on PHP,

$com="sox -m '|sox ".$_SERVER["DOCUMENT_ROOT"]."/content/watermark_audio.mp3 -p pad 4 repeat 5' ".$_SERVER["DOCUMENT_ROOT"]."/content/sound.mp3 ".$_SERVER["DOCUMENT_ROOT"]."/content/sound_watermarked3.mp3";
echo($com."<br>");
exec($com);

nothing is happening!

What's wrong? Please help.

1

There are 1 answers

0
BartW On

There are several options:

  • Use full path to the executable, instead of just sox. You can find the full path by typing which sox in terminal
  • Make sure you are not running PHP in safe_mode
  • Make sure PHP interpreter has permissions to run sox.