Tejas Ramdas
Tejas Ramdas

Reputation: 129

Play MP3 files ON SERVER using PHP?

I have a Raspberry Pi running LAMP on Raspbian.
I want to use it as a media server, i.e. play audio files on the pi itself, when I press play on another computer over the network, to which the pi server is serving the php file.
The issue is that I do not know if it is possible to instruct the server to open a MP3 file through PHP.
If it is possible, how is it done?

Upvotes: 1

Views: 1945

Answers (1)

Simon Groenewolt
Simon Groenewolt

Reputation: 10665

If you don't need a lot of control besides starting a song you could use a command-line audio player (for example: mpg321) to play your files and run it using php exec.

If you don't hear anything you should check if the user that the webserver uses to run is allowed to access the audio device (Lots of linux distributions limit access to the audio device to a special group of users)

Upvotes: 1

Related Questions