Skip to content

Installation. troubleshooting

Vladimir Goncharov edited this page Jan 17, 2021 · 1 revision

while of after installation you can have some errors:

PHP Fatal error: Uncaught Error: Call to undefined function CV\imread()

you forgot to enable php extension after installation / compilation

PHP Warning: PHP Startup: Unable to load dynamic library 'opencv.so'

you forgot to enable php extension after installation / compilation

php: symbol lookup error

If you installed php-opencv from packages and have this error you need to remove php-opencv by command apt remove php-opencv and install php-opencv from sources.

Compilation errors like this:

/opt/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'void opencv_mat_update_property_by_c_mat(zval*, cv::Mat*)':
/usr/include/php7/Zend/zend_types.h:663:38: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'}
error: invalid conversion from 'zval* (*)(zval*, zval*, zval*, void**)' {aka '_zval_struct* (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'} to 'zend_object_write_property_t' {aka 'void (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'}

If you have php version less than 8.0 you need to checkout for right version after git clone. For example:

git clone https://github.com/php-opencv/php-opencv.git && cd php-opencv && git checkout php7.4

problems on centos:

#17 #10 #15

problems on debian: