exec dont work...

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

exec dont work...

Post 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
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

Please?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post 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.
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post 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.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post 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 :)
Post Reply