title: Calling a Python script from PHP, on a MAC with XAMPP
body: <p>I want to build a RESTful API. 
  I am working on a MAC, and I installed the XAMPP server.
  I have a Python script that I want to call it from PHP.</p>
  
  <p>My PHP file looks like:</p>
  
  <pre><code>$output = shell_exec("python $pyfilepath $post-&gt;id $post-&gt;name");
  echo $output;
  </code></pre>
  
  <p>and there is no problem with that.</p>
  
  <p>My python code looks like:</p>
  
  <pre><code>import sys
  #import mysql.connector
  def my_results(id,name):
      print("My args are:",id,name)
  
  if __name__ == '__main__':
      my_results(sys.argv[1],sys.argv[2])
  </code></pre>
  
  <p>I can read and pass parameters to the python script, but if I try to activate the: </p>
  
  <pre><code>import mysql.connector
  </code></pre>
  
  <p>I am not getting any results from my_results definition.</p>
  
  <p>I have everything build on python, and I just need to call my script. Any idea what is wrong?</p>
  
  <p>Thank you</p>