How do I install OpenCV for PHP?-Collection of common programming errors

I’m trying to install OpenCV for PHP but it doesn’t work.
https://github.com/mgdm/OpenCV-for-PHP
I did the following

installed OpenCV

$ sudo aptitude install libcv2.1

tried to install opencv for php

$ sudo phpize && ./configure && make && make install

tried to uses it and I got an error

$ php examples/test_convert.php

php: symbol lookup error: /usr/lib/php5/20090626/opencv.so: undefined symbol: cvSetErrMode

I thought the OpenCV for PHP needs the OpenCV libs address,

$ ldd /usr/lib/php5/20090626/opencv.so linux-vdso.so.1 => (0x00007fff45de2000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd2d74c3000) /lib64/ld-linux-x86-64.so.2 (0x00007fd2d7a8a000)

so I tried this

$ phpize $ ./configure edit Makefile < OPENCV_SHARED_LIBADD = > OPENCV_SHARED_LIBADD = /usr/lib/libcv.so.2.1 $ make

$ sudo make install

and it still doesnt work. I’m using Ubuntu11.04.

Do you have any idea?

Originally posted 2013-11-06 03:30:58.