Page 1 of 1
exec dont work...
Posted: Thu Feb 12, 2004 12:54 pm
by redhair
Code: Select all
<?php
exec("/var/www/html/server_doorbell.sh");
?>
Could anyone provide suggestions?
I'm guessing it's a right's issue.
server_doorbell.sh IS executable.
(When run from shell it provides a nice sound)
Whats in server_doorbell.sh
Code: Select all
#!/bin/bash
soundwrapper play /var/www/html/enter.wav
Posted: Fri Feb 13, 2004 8:14 am
by redhair
Please?
Posted: Fri Feb 13, 2004 8:17 am
by markl999
If you've 'got root' then you could test it by becoming the apache user and running it from a command line to see what's happening.
E.g.
sudo su
su - www-data (or nobody .. whoever apache runs as)
/var/www/html/server_doorbell.sh
Posted: Fri Feb 13, 2004 8:18 am
by jason
Are you sure it's not running? Maybe put something in there that writes to a file?
Edit: And what I mean by that is are you sure the script is not running the shell script? The shell script doesn't seem like it's giving any feedback on whether it's running or not. Maybe return a string saying "Done" from the shell script, and echo that from the return value of exec()? That way you can be more sure the script is actually running.
Posted: Fri Feb 13, 2004 8:47 am
by redhair
markl999 wrote:sudo su nobody /var/www/html/server_doorbell.sh
results in:
sox: Can't open output file '/dev/dsp': Permission denied
Using my account i do get respond.
sudo su redhair /var/www/html/server_doorbell.sh
results in: a nice sound beeing played.
Should I try and chown server_doorbell.sh into user nobody?
edit: or apache..no..that didnt work,...get the same error.
Posted: Fri Feb 13, 2004 9:06 am
by markl999
You probably just need to make 'nobody' a member of the 'sound' group or whatever it's called on your distro. See what the ownership/permissions are on /dev/dsp
Posted: Fri Feb 13, 2004 10:42 am
by redhair
markl999 wrote:You probably just need to make 'nobody' a member of the 'sound' group or whatever it's called on your distro. See what the ownership/permissions are on /dev/dsp
Thanks! That did it
Although not as expected..
I changed the exec("/var/www/html/enter.sh");
into
exec('soundwrapper play /var/www/html/enter.wav");
..hey if it works, it works
