I've searched for help and tried everything on this thread, but still can't make this work. I'm trying to run the sox (Sound eXchange) command line utility from my PHP script using shell_exec(). I need to concatenate two audio files, both of which are in the same directory as the PHP script (i.e. accessible to apache).
Here's the confusion:
- Some sox commands work fine using shell_exec(). For example I can play an audio file or retrieve information about it.
- If I echo out the concatenation command (so I know exactly what PHP is sending to the shell) and then copy and paste it into a shell window, it runs perfectly.
- My apache user (_www) has full rights to the directory where the PHP script is, as well as the sox directory. I ran "chown -R _www:_www" and "chmod -R 777" on both directories.
- I'm using the full path to the sox executable and the audio files.
So this works in the shell:
"/soxpath/sox /filepath/file1.wav /filepath/file2.wav /filepath/combined.wav"
But this doesn't work from PHP:
shell_exec('/soxpath/sox /filepath/file1.wav /filepath/file2.wav /filepath/combined.wav');
Can anyone shed some light on this? What am I missing? Thanks.