title: Python Local Package Doesn't Load In Call From PHP
body: <p>So, I want to run a Python program with a home-directory install of PyProj from PHP. The PHP and Python are simple, but I include them below for completeness.</p>
  
  <p>I've tested running Python manually using both <code>sys.path.append</code> and <code>PYTHONPATH</code> to specify the location of the package. Both of these methods work.</p>
  
  <p>However, when I <code>shell_exec</code> the script from PHP, I'm told <code>ImportError: No module named pyproj</code>.</p>
  
  <p>A recursive check of the file system reveals that everything is read/executable by user, group, and other.</p>
  
  <p>Any thoughts on why this I can't get this to run?</p>
  
  <p>I'm calling it in a PHP script as follows</p>
  
  <pre><code>&lt;?php
          putenv('PYTHONPATH="/home/userperson/public_html/lib64/python2.4/site-packages"');
          $ret=shell_exec("./bob");
          print $ret;
  ?&gt;
  </code></pre>
  
  <p>The Python program is simple.</p>
  
  <pre><code>#!/usr/bin/python
  import pyproj
  import sys
  sys.path.append("/home/userperson/public_html/lib64/python2.4/site-packages")
  surfproj = pyproj.Proj(proj='lcc',lat_1=40,lat_2=50,lon_0=-95,lat_0=40,ellps='WGS84')
  x,y=surjproj(-95,45)
  print x
  </code></pre>