I wrote a little php script to control the volume of my local machine with alsa:
<?php # for simplicity and testing it really just executes the command: echo exec('amixer set Master 5%+') . " \n";
Now when I run this script on command line it works fine:
$ php volume.php Front Right: Playback 39226 [60%] [on] $ php volume.php Front Right: Playback 42503 [65%] [on] $ php volume.php Front Right: Playback 45780 [70%] [on]
I have music playing and I hear it getting louder.
But when I try to run the script via apache from the browser calling
http://localhost/volume.php it doesn't work.
# http://localhost/volume.php Front Right: Playback 55709 [10%] [on] # F5 Front Right: Playback 55709 [15%] [on] # F5 Front Right: Playback 55709 [20%] [on]
Now I hear no change in volume and the percentages seem to be unrelated to the current state. It says 10% - 15% - 20% when it really is still at 70%.
My apache is running as my user so
exec('whoami') gives me the username I am logged in with on my shell where everything works fine.
# httpd.conf User mkt Group mkt
I'm on Fedora 22.