title: PHP cannot connect to mysql through python
body: <p>Im writing a PHP to exec a python script which connects to mysql like this</p>
  
  <pre><code>&lt;?php
      echo shell_exec('python doSmt.py 2&gt;&amp;1');
  &lt;/body&gt;&lt;/html&gt;")
  ?&gt;
  </code></pre>
  
  <p>in Python script:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  import mysql.connector
  </code></pre>
  
  <p>and get this error</p>
  
  <blockquote>
    <p>Traceback (most recent call last): File "doSmt.py", line 2, in import
    mysql.connector ImportError: No module named mysql.connector</p>
  </blockquote>
  
  <p>please help</p>
  
  <p>UPDATE:
  I tried checking packages installed on php web server from netbeans</p>
  
  <pre><code># -*- coding: utf-8 -*-
  import pkg_resources
  installed_packages = pkg_resources.working_set
  installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
       for i in installed_packages])
  print(installed_packages_list)
  </code></pre>
  
  <p>and got this</p>
  
  <blockquote>
    <p>'altgraph==0.10.2', 'backports-abc==0.5', 'bdist-mpkg==0.5.0',
    'bonjour-py==0.3', 'certifi==2018.4.16', 'chardet==3.0.4',
    'click==6.7', 'flask==1.0.2', 'futures==3.2.0', 'idna==2.7',
    'itsdangerous==0.24', 'jinja2==2.10', 'macholib==1.5.1',
    'markupsafe==1.0', 'matplotlib==1.3.1', 'modulegraph==0.10.4',
    'nose==1.3.7', 'numpy==1.8.0rc1', 'pip==10.0.1', 'py2app==0.7.3',
    'pyobjc-core==2.5.1', 'pyobjc-framework-accounts==2.5.1',
    'pyobjc-framework-addressbook==2.5.1',
    'pyobjc-framework-applescriptkit==2.5.1',
    'pyobjc-framework-applescriptobjc==2.5.1',
    'pyobjc-framework-automator==2.5.1',
    'pyobjc-framework-cfnetwork==2.5.1', 'pyobjc-framework-cocoa==2.5.1',
    'pyobjc-framework-collaboration==2.5.1',
    'pyobjc-framework-coredata==2.5.1',
    'pyobjc-framework-corelocation==2.5.1',
    'pyobjc-framework-coretext==2.5.1',
    'pyobjc-framework-dictionaryservices==2.5.1',
    'pyobjc-framework-eventkit==2.5.1',
    'pyobjc-framework-exceptionhandling==2.5.1',
    'pyobjc-framework-fsevents==2.5.1',
    'pyobjc-framework-inputmethodkit==2.5.1',
    'pyobjc-framework-installerplugins==2.5.1',
    'pyobjc-framework-instantmessage==2.5.1',
    'pyobjc-framework-latentsemanticmapping==2.5.1',
    'pyobjc-framework-launchservices==2.5.1',
    'pyobjc-framework-message==2.5.1',
    'pyobjc-framework-opendirectory==2.5.1',
    'pyobjc-framework-preferencepanes==2.5.1',
    'pyobjc-framework-pubsub==2.5.1', 'pyobjc-framework-qtkit==2.5.1',
    'pyobjc-framework-quartz==2.5.1',
    'pyobjc-framework-screensaver==2.5.1',
    'pyobjc-framework-scriptingbridge==2.5.1',
    'pyobjc-framework-searchkit==2.5.1',
    'pyobjc-framework-servicemanagement==2.5.1',
    'pyobjc-framework-social==2.5.1',
    'pyobjc-framework-syncservices==2.5.1',
    'pyobjc-framework-systemconfiguration==2.5.1',
    'pyobjc-framework-webkit==2.5.1', 'pyopenssl==0.13.1',
    'pyparsing==2.0.1', 'python-dateutil==1.5', 'python==2.7.10',
    'pytz==2013.7', 'requests==2.19.1', 'scipy==0.13.0b1',
    'setuptools==18.5', 'singledispatch==3.4.0.3', 'six==1.4.1',
    'tornado==5.0.2', 'urllib3==1.23', 'werkzeug==0.14.1',
    'wheel==0.31.1', 'wsgiref==0.1.2', 'xattr==0.6.4',
    'zope.interface==4.1.1'</p>
  </blockquote>
  
  <p>There's no package relating to mysql. I think this is the problem. But how to fix this?</p>