Score:0

No sound from MPG321 when played through php executed python script ( permissions are not the problem)

ae flag

I am trying to execute an audio file running as a python subprocess(shell=True) using mpg321. just running python script from terminal as user works, running the audio file through mpg321 from terminal as user works. However when my website calls a php script to execute this python script mpg321 returns an error. I know the most obvious answer is to check permissions, however this system has been working fine until now since when I set it up a year ago, I fixed the permissions by giving apache full access ( made it run as user, I know its bad, but only thing that worked then). Recently, had issues with speakerphone connecting using pulseaudio due to not having hands free profile, I changed to pipewire. Bluetooth issues are sorted, but audio (via php) problem emerged.

The error I get when playing mpg321 (via php) is 'Can't find a suitable libao driver (is device in use)'. obviously, I tried to check permissions, they are all set. www-data and user are also part of the audio group, checked whoami and apache user they are user.

so next I did apt install libao driver, suprsingly the error went away, mpg321 processed the mp3 file but NO AUDIO COULD BE HEARD. I looked at pavucontrol, alsamixer to see if its muted etc, NO!. Forums suggested should try -o alsa with mpg321 and voila I get the same error regarding libao again, meanwhile via terminal with or without -o alsa sound works.

Its such a weird issue, I am running out of options to debug.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.