title: Need a PHP button for a python script
body: <pre><code>&lt;html&gt;
   &lt;body&gt;
  
     &lt;form method=&quot;post&quot;&gt;
  
      &lt;input type=&quot;submit&quot; value=&quot;GO&quot; name=&quot;GO&quot;&gt;
     &lt;/form&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;?php
      if(isset($_POST['GO']))
      {
          shell_exec(&quot;python /var/www/html/test/test.py&quot;);
          echo&quot;success&quot;;
      }
  ?&gt;
  </code></pre>
  <pre><code>import sys
  from datetime import date
  from datetime import datetime
  import pytest
  import time
  import paramiko
  
  sys.stdout = open('logs.txt','a')
  today = date.today()
  # datetime object containing current date and time
  now = datetime.now()
  
  # mm/dd/YY H:M:S
  dt_string = now.strftime(&quot;%m/%d/%Y %H:%M:%S&quot;)
  print(&quot;Logs:&quot;, dt_string)
  
  ssh_client = paramiko.SSHClient()
  ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh_client.connect('IP', username='root', password='pw')
  print(&quot;Connected&quot;)
  #stdin, stdout, stderr = ssh_client.exec_command('sudo reboot')
  print(&quot;Rebooted&quot;)
  print(&quot;----------&quot;)
  print(&quot;&lt;br&gt;&lt;/br&gt;&quot;)
  </code></pre>
  <p>It isn't executing in the PHP button. I don't know if this code is proper. Anyone have any ideas why it isn't working on the PHP side I tried using flask didn't have any luck. I don't know if it's even possible what i'm trying to do. Anyone have any ideas? The top is PHP and bottom is the Python code.</p>