[PLUG-TALK] php system command problem

Richard C. Steffens rsteff at comcast.net
Mon May 26 18:23:36 UTC 2008


Some years ago I wrote a php program to play music from my collection of
.mp3 files on the living room stereo using a machine in the basement.
Before the machine died, the program worked, so I know that what I used
to do with that version of php worked. While I can't be certain, I think
I was using php 4.

Today I'm trying to write a php program to control my x10 CP-290. I'm
using the php system command to send commands to a program called x10.
If I run the x10 program from the command line it does what it's
supposed to do. When I run it from the system command of php 5, nothing
happens.

I've tried simple things like sending "ls -a" from the system command in
php and I get what I expect.

The x10 command that works from the command line looks like this:

rsteff at Moonguide:~> x10 turn k5 on > /dev/null &
[1] 23509
rsteff at Moonguide:~>
[1]+  Done                    x10 turn k5 on >/dev/null
rsteff at Moonguide:~>

The way I'm trying to use it in php looks like this:

        <?php

          // Build command string
          $command = "/home/rsteff/bin/x10 turn k5 on > /dev/null &";

          // Send command
          system($command);

          ?>

I'm guessing that there's some subtle thing I'm missing. Application of
appropriate clue stick requested.


-- 
Regards,

Dick Steffens




More information about the PLUG-talk mailing list