brainfreeze Posted August 10, 2007 Posted August 10, 2007 Hey everyone, great site. I can't belive its taken me this long to sign up. This being my first post and everything, yet the first thing i do is ask a question may be a bit cheeky, but it has to be done! Maybe someone can help. In some of the episodes i've noticed the lads run commands on windows boxes running apache and php. Things like turning on winamp etc. Now i have a linux box with php and apache installed, and i figured the system command would be fairly similar, but it doesn't seem to want to run any program i ask it too. For example i have: <html> <body> <?php if(isset($_GET['music'])) { if($_GET['music'] == "sexy") { system("(xmms --play /home/brainfreeze/air.m3u) > null"); echo "playing -- please wait"; } } ?> <a href="test.php?music=sexy">sexy</a> </body> </html> yet xmms will not run, even if i use system("xmms"); or system("xmms --play /home/brainfreeze/air. m3u"); however if i do system("ls"); it has no problem displaying me the output, so atleast i know something is being sent to the command line. What am i doing wrong? Its really boggling my php-noob head. :( Quote
SomeoneE1se Posted August 10, 2007 Posted August 10, 2007 not knowing xmms I might guess it's bad syntax what happens when you drop the ()'s Quote
brainfreeze Posted August 10, 2007 Author Posted August 10, 2007 Hey, thanks for the reply. By syntax im assuming your talking about the command rather than the php itself? "xmms --play /home/brainfreeze/air.m3u" is valid syntax as it works perfectly when i type it into a shell. To answer your question, when i leave out the ()'s, the result is still the same. xmms (or any other application i've tried so far) doesn't launch. But yet basic commands such as 'ls' etc still do. Thanks in advance Quote
ultrarazen Posted August 11, 2007 Posted August 11, 2007 It could be like the problem some other lad had in Windows where you had to give the apache service permission to interact with the desktop. Quote
SomeoneE1se Posted August 11, 2007 Posted August 11, 2007 system("xmms --play /home/brainfreeze/air.m3u > null"); ? or exec("(xmms --play /home/brainfreeze/air.m3u) > null"); and exec("xmms --play /home/brainfreeze/air.m3u > null"); ? Quote
cooper Posted August 13, 2007 Posted August 13, 2007 See what gets written into that null file, or if this was shorthand for /dev/null then leave that out and see if it spits out any errors over stdout rather than stderr. Quote
jollyrancher82 Posted August 15, 2007 Posted August 15, 2007 The user apache is usually running as it usually www/nobody who don't have permission to run binaries. This is because letting apache run applications is a security risk. Quote
soulbleed Posted August 15, 2007 Posted August 15, 2007 ls probably works because it's built into the shell. Try using the full path to your xmms binary. Quote
brainfreeze Posted August 31, 2007 Author Posted August 31, 2007 Sorry for the late replies guys. I got distracted with what i was trying to achieve with Apache, and bought a Nintendo wii. Since then I've been messing around with the remote. I'll try out some of the above ideas and, especially the Apache users as that looks the most promising. I'll get back to shortly. Jahova. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.