Playing sound on server using php

Posted by Lorenz on Super User See other posts from Super User or by Lorenz
Published on 2012-07-19T15:12:28Z Indexed on 2012/10/12 9:41 UTC
Read the original article Hit count: 282

Filed under:
|
|
|
|

I want to play a sound file on my server using PHP. The PHP script is called by Apache and runs under the user 'nobody', which has by default no access to the speakers. So I created a new user soundoutput which is allowed do play sound and has read permissions for the sound files he should play.

If I'm logged in as root, I can play a sound file using echo password | sudo -Su soundoutput mpg321 '/path/to/sound.mp3'. The problem is, that it doesn't work when I'm executing this command using PHP's system_exec. I guess that user nobody isn't allowed to run sudo, but what can I do that he is allowed to do that?

Any help appreciated.

© Super User or respective owner

Related posts about linux

Related posts about permissions