1.1. Call Python script from PHP

Problem : you want to call a Python script from a PHP page on your web server. Sometimes it does not work. To solve the problem do the following:

1.1.1. Install Python Anaconda and related packages

Install Python Anaconda in /opt/anaconda (download from conda.io)

Execute installation script and put Anaconda in /opt/anaconda3/:

sudo ./Anaconda3-5.0.1-Linux-x86_64.sh

Install numpy and BioPython :

conda install numpy
conda install biopython

1.1.2. Modify the owner, group and rights for execution

In the public_html directory where you python script reside, do the following:

sudo chown www-data script.py
sudo chgrp www-data script.py
sudo chmod a+x script.py

1.1.3. Modify your Python script

Then in your Python script (script.py) put as first lines:

#!/opt/anaconda/bin/python
import sys
sys.path.append('/opt/anaconda3/bin')