Please login or register.

Login with username, password and session length
Advanced search  


The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Author Topic: PHP script not executing ahcmd  (Read 6025 times)


  • Newbie
  • Helpful Post Rating: 0
  • Posts: 8
PHP script not executing ahcmd
« on: March 21, 2009, 12:13:17 PM »

Greetings all,
I've created a PHP script to execute X-10 commands from a web site.
I get no errors from PHP, nor form the web server. Still, it does not execute.
I can run the command from a cmd window and it works fine.
So, it seems I have a disconnect between the script and the ahcmd.exe.
I'll post the code below, but am hoping some one can ask the right question(s) to get me looking in the right place.

  <title>ActiveHome PHP Control</title>
if (!isset($_POST['hc']))
$_POST['hc'] = "A";
if (!isset($_POST['uc']))
$_POST['uc'] = "1";

if (!isset($_POST['cmd']))
$_POST['cmd'] = "Off";
<form action="ahp.php" method="post">
   <img src="./art/ahp_logo_204x65.png" width="204" height="65" alt="activehome pro php control">
   <table cellpadding="0" cellspacing="0" border="0" width="162">
   <tr><td background="./art/mm162x64_roombaraqua.png" valign="top" align="center">
      <font color="#FFFFFF"><B>PHP Control</B></font>
   <tr><td bgcolor="#d3c8a7">
      <table cellpadding="2" cellspacing="0" border="0" width="100%">
      <tr><td align="left">   
         <B>House Code</b>
      </td><td align="right">
         <select name="hc">
            <option value="A">A</option>
            <option value="B">B</option>
            <option value="C">C</option>
            <option value="D">D</option>
            <option value="E">E</option>
            <option value="F">F</option>
            <option value="G">G</option>
            <option value="H">H</option>
            <option value="I">I</option>
            <option value="J">J</option>
            <option value="K">K</option>
            <option value="L">L</option>
            <option value="M">M</option>
            <option value="N">N</option>
            <option value="O">O</option>
            <option value="P">P</option>
      <tr><td align="left">
         <B>Unit Code</b>
      </td><td align="right">
         <select name="uc">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="9">9</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
            <option value="16">16</option>
      <tr><td align="left">
      </td><td align="right">
         <select name="cmd">
            <option value="On">ON</option>
            <option value="Off">OFF</option>
   <tr><td align="center" bgcolor="#d3c8a7">
      <input type="text" size="15" value="<?php echo $_POST['hc'].$_POST['uc']." ".$_POST['cmd']; ?>">
   <tr><td align="right" bgcolor="#d3c8a7">
      <input type="submit" value="Run"/>
<?php $cmdstring = $_POST['hc'].$_POST['uc']." ".$_POST['cmd'];
exec ("ahcmd.exe sendplc $cmdstring");?>



  • Newbie
  • Helpful Post Rating: 0
  • Posts: 8
Re: PHP script not executing ahcmd <Update>
« Reply #1 on: March 22, 2009, 12:01:20 PM »

I found out the reason why the script was not executing.
The DCOM service on IIS did not have the security settings for the IIS service.
Once I added the IIS service account with permissions to execute the script worked!!!

Yippy! I can nnow control my X-10 devices with my Blackberry browser! >! :)%
Logged | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 All rights reserved.