apache上的Python / Opencv

all,

I am trying to run Python with Opencv on Apache2 server using PHP.

My PHP code is:

$output = shell_exec('./cv.sh');
echo $output;

Shell command ./cv.sh is:

python /var/www/html/testcv.py

And Python code is:

import cv2

ori= cv2.imread('/var/www/html/face.jpeg')
cv2.imwrite('/var/www/html/facer1.jpeg',ori)

For some reason, the Python script failed to copy the image IF I run from browser, BUT if I directly run the ./cv.sh at server, it works fine.

CV environment is turned on at server. and everything is set to chmod 777 (I just want to get this work first).

Can anyone help? Thanks in advance.

To answer my own question.

sudo apt-get install python-opencv