Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
php execute command on server
Old
  (#1)
Jody Gugelhupf
Guest
 
Posts: n/a
Default php execute command on server - 06-02-2007, 08:55 PM

hi ppl
i run apache 2 on ubuntu feisty with php 5, i have website on which i have 2 links, the first is a
php which should start a vlc stream server on my server (see below), streaming from my tvcard, the
vlc command itself executed on my machine from the console shows that the command works fine, this
probably means that somehting is wrong with my php file.
the second command opens the vlc stream from the server, which works fine too
anyhow back to the first command the vlc stream server executer, i can see it in the list of the
running processes on my machine, but the stream does not work, i don't know why, either there is
somehting wrong with my php:

<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo system('vlc
v4l:/dev/video0:norm=pal:frequency=767250:size=320x240:chan nel=0:adev=/dev/dsp:audio=0 --sout
\'#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=25 6,vt=800000,keyint=80,deinterlace=blend}:std{acces s=http,mux=ts,url=10.0.0.1:8082}\'
--ttl 12 -I dummy');
?>

or does the www-data (apache) user needs special user permissions to access the devices
/dev/video0 /dev/dsp ? i have no clue, is there a way to see some output? thx for the help
katie


Get news delivered with the All new Yahoo! Mail. Enjoy RSS feeds right on your Mail page. Start today at http://mrd.mail.yahoo.com/try_beta?.intl=ca
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: [PHP] php execute command on server
Old
  (#2)
Greg Donald
Guest
 
Posts: n/a
Default Re: [PHP] php execute command on server - 06-02-2007, 08:55 PM

On 5/28/07, Jody Gugelhupf <EMAIL REMOVED> wrote:
> or does the www-data (apache) user needs special user permissions to access the devices
> /dev/video0 /dev/dsp ? i have no clue, is there a way to see some output? thx for the help


You can become the user you want to test permissions for:

sudo su -

su - www-data

On my Feisty install the www-data user does not have the permissions
you require.

cat /dev/dsp
cat: /dev/dsp: Permission denied

To access /dev/dsp the www-data user needs to be a member of the audio
group. You can use usermod to add the audio group to the www-data
user:

usermod -G www-data,audio www-data

After this I begin to get output from /dev/dsp as the www-data user.

Hope that help.


--
Greg Donald
http://destiney.com/
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] php execute command on server
Old
  (#3)
Richard Lynch
Guest
 
Posts: n/a
Default Re: [PHP] php execute command on server - 06-02-2007, 08:56 PM

On Mon, May 28, 2007 6:02 pm, Jody Gugelhupf wrote:
> vlc command itself executed on my machine from the console shows that
> the command works fine, this
> probably means that somehting is wrong with my php file.


Not necessarily all that useful...

PHP runs as a different user in a different environment than you do in
your logged in shell.

su to the PHP User and try running the vlc thingie.

> the second command opens the vlc stream from the server, which works
> fine too
> anyhow back to the first command the vlc stream server executer, i can
> see it in the list of the
> running processes on my machine, but the stream does not work, i don't
> know why, either there is
> somehting wrong with my php:
>
> <?php
> // outputs the username that owns the running php/httpd process
> // (on a system with the "whoami" executable in the path)
> echo system('vlc
> v4l:/dev/video0:norm=pal:frequency=767250:size=320x240:chan nel=0:adev=/dev/dsp:audio=0
> --sout
> \'#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=25 6,vt=800000,keyint=80,deinterlace=blend}:std{acces s=http,mux=ts,url=10.0.0.1:8082}\'
> --ttl 12 -I dummy');
> ?>
>
> or does the www-data (apache) user needs special user permissions to
> access the devices
> /dev/video0 /dev/dsp ? i have no clue, is there a way to see some
> output? thx for the help



Use http://php.net/exec and check the error codes returned.

Almost for sure, yes, the PHP user needs to be added to whatever group
has access to those devices.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top