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.
I've tested running Python manually using both sys.path.append and PYTHONPATH to specify the location of the package. Both of these methods work.
However, when I shell_exec the script from PHP, I'm told ImportError: No module named pyproj.
A recursive check of the file system reveals that everything is read/executable by user, group, and other.
Any thoughts on why this I can't get this to run?
I'm calling it in a PHP script as follows
<?php
putenv('PYTHONPATH="/home/userperson/public_html/lib64/python2.4/site-packages"');
$ret=shell_exec("./bob");
print $ret;
?>
The Python program is simple.
#!/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
import sysfirst, thenprint sys.path? Does the output include the directory that contains your module?