php-opencv / php-opencv

opencv 4.5+ with dnn module for php 7/8

Home Page:https://github.com/php-opencv/php-opencv-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php: symbol lookup error

quangduz opened this issue · comments

durza@durza-pc:~/php-opencv-examples$ php detect_face_by_dnn_ssd.php php: symbol lookup error: /usr/lib/php/20170718/opencv.so: undefined symbol: _ZN2cv6imreadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi durza@durza-pc:~/php-opencv-examples$
OS: Ubuntu 18.04.3 LTS
PHP: 7.2
OpenCV: 3.4

help me pls :(

SOLVED !

commented

I run into a similar error:

symbol lookup error: /usr/lib/php/20190902/opencv.so: undefined symbol: _ZN2cv3dnn14dnn4_v2020090821readNetFromTensorflowEPKcmS3_m

OS : Debian 10
PHP: 7.4.13
OpenCV: 4.5

Help me please!

@awar33

apt update && apt install -y pkg-config cmake git php-dev
git clone https://github.com/php-opencv/php-opencv.git
cd php-opencv && git checkout php7.4 && phpize && ./configure --with-php-config=/usr/bin/php-config && make && make install
echo "extension=opencv.so" > /etc/php/7.4/cli/conf.d/opencv.ini
echo "extension=opencv.so" > /etc/php/7.4/fpm/conf.d/opencv.ini
echo "extension=opencv.so" > /etc/php/7.4/apache2/conf.d/opencv.ini
commented

@morozovsk

Thanks, I tried that.

  • from which git folder I am supposed to run "git checkout php7.4"?

  • "./configure" gives me that:

Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902

  • And then "make" runs with errors, any help appreciated here:

/bin/bash /home/user/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/user/php-opencv -DPHP_ATOM_INC -I/home/user/php-opencv/include -I/home/user/php-opencv/main -I/home/user/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /home/user/php-opencv/source/opencv2/core/opencv_mat.cc -o source/opencv2/core/opencv_mat.lo
libtool: compile: g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/user/php-opencv -DPHP_ATOM_INC -I/home/user/php-opencv/include -I/home/user/php-opencv/main -I/home/user/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /home/user/php-opencv/source/opencv2/core/opencv_mat.cc -fPIC -DPIC -o source/opencv2/core/.libs/opencv_mat.o
In file included from /usr/include/php/20190902/Zend/zend.h:27,
from /usr/include/php/20190902/main/php.h:34,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc: In function ‘void opencv_mat_update_property_by_c_mat(zval*, cv::Mat*)’:
/usr/include/php/20190902/Zend/zend_types.h:701:38: error: cannot convert ‘zend_object*’ {aka ‘_zend_object*’} to ‘zval*’ {aka ‘_zval_struct*’}
#define Z_OBJ(zval) (zval).value.obj
~~~~~~~~~~~~~^~~
/usr/include/php/20190902/Zend/zend_types.h:702:28: note: in expansion of macro ‘Z_OBJ’
#define Z_OBJ_P(zval_p) Z_OBJ((zval_p))
^~~~~
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:53:46: note: in expansion of macro ‘Z_OBJ_P’
zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "rows", sizeof("rows")-1, mat->rows);
^~~~~~~
In file included from /usr/include/php/20190902/main/php.h:38,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_API.h:341:72: note: initializing argument 2 of ‘void zend_update_property_long(zend_class_entry
, zval*, const char*, size_t, zend_long)’
ZEND_API void zend_update_property_long(zend_class_entry scope, zval object, const char name, size_t name_length, zend_long value);
~~~~~~^~~~~~
In file included from /usr/include/php/20190902/Zend/zend.h:27,
from /usr/include/php/20190902/main/php.h:34,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_types.h:701:38: error: cannot convert ‘zend_object
’ {aka ‘_zend_object
’} to ‘zval
’ {aka ‘_zval_struct*’}
#define Z_OBJ(zval) (zval).value.obj
~~~~~~~~~~~~~^~~
/usr/include/php/20190902/Zend/zend_types.h:702:28: note: in expansion of macro ‘Z_OBJ’
#define Z_OBJ_P(zval_p) Z_OBJ((zval_p))
^~~~~
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:54:46: note: in expansion of macro ‘Z_OBJ_P’
zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "cols", sizeof("cols")-1, mat->cols);
^~~~~~~
In file included from /usr/include/php/20190902/main/php.h:38,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_API.h:341:72: note: initializing argument 2 of ‘void zend_update_property_long(zend_class_entry
, zval*, const char*, size_t, zend_long)’
ZEND_API void zend_update_property_long(zend_class_entry scope, zval object, const char name, size_t name_length, zend_long value);
~~~~~~^~~~~~
In file included from /usr/include/php/20190902/Zend/zend.h:27,
from /usr/include/php/20190902/main/php.h:34,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_types.h:701:38: error: cannot convert ‘zend_object
’ {aka ‘_zend_object
’} to ‘zval
’ {aka ‘_zval_struct*’}
#define Z_OBJ(zval) (zval).value.obj
~~~~~~~~~~~~~^~~
/usr/include/php/20190902/Zend/zend_types.h:702:28: note: in expansion of macro ‘Z_OBJ’
#define Z_OBJ_P(zval_p) Z_OBJ((zval_p))
^~~~~
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:55:46: note: in expansion of macro ‘Z_OBJ_P’
zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "dims", sizeof("dims")-1, mat->dims);
^~~~~~~
In file included from /usr/include/php/20190902/main/php.h:38,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_API.h:341:72: note: initializing argument 2 of ‘void zend_update_property_long(zend_class_entry
, zval*, const char*, size_t, zend_long)’
ZEND_API void zend_update_property_long(zend_class_entry scope, zval object, const char name, size_t name_length, zend_long value);
~~~~~~^~~~~~
In file included from /usr/include/php/20190902/Zend/zend.h:27,
from /usr/include/php/20190902/main/php.h:34,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_types.h:701:38: error: cannot convert ‘zend_object
’ {aka ‘_zend_object
’} to ‘zval
’ {aka ‘_zval_struct*’}
#define Z_OBJ(zval) (zval).value.obj
~~~~~~~~~~~~~^~~
/usr/include/php/20190902/Zend/zend_types.h:702:28: note: in expansion of macro ‘Z_OBJ’
#define Z_OBJ_P(zval_p) Z_OBJ((zval_p))
^~~~~
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:56:46: note: in expansion of macro ‘Z_OBJ_P’
zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "type", sizeof("type")-1, mat->type());
^~~~~~~
In file included from /usr/include/php/20190902/main/php.h:38,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_API.h:341:72: note: initializing argument 2 of ‘void zend_update_property_long(zend_class_entry
, zval*, const char*, size_t, zend_long)’
ZEND_API void zend_update_property_long(zend_class_entry scope, zval object, const char name, size_t name_length, zend_long value);
~~~~~~^~~~~~
In file included from /usr/include/php/20190902/Zend/zend.h:27,
from /usr/include/php/20190902/main/php.h:34,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_types.h:701:38: error: cannot convert ‘zend_object
’ {aka ‘_zend_object
’} to ‘zval
’ {aka ‘_zval_struct*’}
#define Z_OBJ(zval) (zval).value.obj
~~~~~~~~~~~~~^~~
/usr/include/php/20190902/Zend/zend_types.h:702:28: note: in expansion of macro ‘Z_OBJ’
#define Z_OBJ_P(zval_p) Z_OBJ((zval_p))
^~~~~
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:66:45: note: in expansion of macro ‘Z_OBJ_P’
zend_update_property(opencv_mat_ce, Z_OBJ_P(z), "shape", sizeof("shape")-1, &shape_zval);
^~~~~~~
In file included from /usr/include/php/20190902/main/php.h:38,
from /home/user/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
from /home/user/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php/20190902/Zend/zend_API.h:338:67: note: initializing argument 2 of ‘void zend_update_property(zend_class_entry
, zval*, const char*, size_t, zval*)’
ZEND_API void zend_update_property(zend_class_entry scope, zval object, const char name, size_t name_length, zval value);
~~~~~~^~~~~~
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc: In function ‘zval
opencv_mat_write_property(zend_object
, zend_string
, zval
, void**)’:
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:841:70: error: cannot convert ‘zend_object*’ {aka ‘_zend_object*’} to ‘zval*’ {aka ‘_zval_struct*’} in argument passing
std_object_handlers.write_property(object,member,value,cache_slot);
^
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc: In function ‘void opencv_mat_init()’:
/home/user/php-opencv/source/opencv2/core/opencv_mat.cc:857:49: error: invalid conversion from ‘zval* ()(zend_object, zend_string*, zval*, void**)’ {aka ‘_zval_struct* ()(_zend_object, _zend_string*, _zval_struct*, void**)’} to ‘zend_object_write_property_t’ {aka ‘_zval_struct* ()(_zval_struct, _zval_struct*, _zval_struct*, void**)’} [-fpermissive]
opencv_mat_object_handlers.write_property = opencv_mat_write_property;
^~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:194: source/opencv2/core/opencv_mat.lo] Error 1

from which git folder I am supposed to run "git checkout php7.4"?

from php-opencv

commented

Thanks for helping,

I successfully installed php-opencv from source (I previously did from package). But I still got the exact same error in php:

symbol lookup error: /usr/lib/php/20190902/opencv.so: undefined symbol: _ZN2cv3dnn14dnn4_v2020090821readNetFromTensorflowEPKcmS3_m

Do you know why this is happening?

you have two different binary version of php with different modules.
so you compiled library for one and trying to use with secondary not binary compatible. so that is the reason why you have errors "symbol not found".

#21

Or you didn't remove previous version of php-opencv.

And then "make" runs with errors, any help appreciated here

don't forget:

make install

commented

Thanks again for your help. Ok, I think I can exclude having two different binary version of php because:

php -v PHP 7.4.13 (cli) (built: Nov 30 2020 20:40:09) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
and
php7.4 -v PHP 7.4.13 (cli) (built: Nov 30 2020 20:40:09) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies

Right?

So that leaves me with your other suggestion: I didn't remove previous version of php-opencv. How can I verify that?

It's true that I tried with php7.3 before installing php7.4. I did a purge php7.3 libapache2-mod-php7.3 but this is perhaps not sufficient?

I didn't forget to run "make install"

Right?

yes... may be :)

So that leaves me with your other suggestion: I didn't remove previous version of php-opencv. How can I verify that?

If you installed php-opencv.deb try to uninstall: apt remove php-opencv

It's true that I tried with php7.3 before installing php7.4.

debian 10.7 by default has php 7.3. how did you install 7.4?

try:

cd /php-opencv && make test

and show me logs

cd /php-opencv && phpize --clean && phpize && ./configure --with-php-config=/usr/bin/php-config && make && make install && make test and check time of file /usr/lib/php/20190902/opencv.so

and show me logs

php -v && apt info php-dev && apt info php-cli

and show me logs

commented

If you installed php-opencv.deb try to uninstall: apt remove php-opencv

Yes I did. Done, removed. Still got the same error after all the process here below.

debian 10.7 by default has php 7.3. how did you install 7.4?

By adding a repository (sury)

$make test
Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP         : /usr/bin/php7.4 
PHP_SAPI    : cli
PHP_VERSION : 7.4.13
ZEND_VERSION: 3.4.0
PHP_OS      : Linux - Linux plateforme 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64
INI actual  : /root/php-opencv/tmp-php.ini
More .INIs  :   
CWD         : /root/php-opencv
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2021-01-14 21:00:46
=====================================================================
PASS Check for opencv presence [tests/001.phpt] 
PASS absdiff function test [tests/absdiff.phpt] 
PASS CV add function test [tests/add.phpt] 
PASS Draw circle test [tests/circle.phpt] 
PASS Check for opencv constant [tests/constant.phpt] 
PASS CV test [tests/cv.phpt] 
FAIL DNN::blobFromImage [tests/dnn.phpt] 
PASS Ellipse test [tests/ellipse.phpt] 
PASS LBPHFaceRecognizer [tests/faceRecognizer.phpt] 
PASS LBPHFaceRecognizer with Decode [tests/faceRecognizerDecode.phpt] 
PASS FacemarkLBF::create [tests/facemark.phpt] 
PASS get_structuring_element function test [tests/get_structuring_element.phpt] 
PASS CV magnitude function test [tests/magnitude.phpt] 
PASS Mat __construct [tests/mat.phpt] 
PASS Exception [tests/opencv_exception.phpt] 
PASS ROI test [tests/roi.phpt] 
PASS split test [tests/split.phpt] 
PASS Type test [tests/type.phpt] 
PASS CV\VideoCapture Class test [tests/videoCapture.phpt] 
=====================================================================
TIME END 2021-01-14 21:00:50

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   15
---------------------------------------------------------------------

Number of tests :   19                19
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (  5.3%) (  5.3%)
Tests passed    :   18 ( 94.7%) ( 94.7%)
---------------------------------------------------------------------
Time taken      :    4 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
DNN::blobFromImage [tests/dnn.phpt]
=====================================================================

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.	You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: n
make: *** [Makefile:132: test] Error 1
$ phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
$ ./configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20190902
checking for PHP installed headers prefix... /usr/include/php/20190902
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for opencv support... yes, shared
checking for php debug... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for pkg-config... found
checking for opencv... found 4.5.0
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
$ make
/bin/bash /root/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/php-opencv -DPHP_ATOM_INC -I/root/php-opencv/include -I/root/php-opencv/main -I/root/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /root/php-opencv/opencv.cc -o opencv.lo 
libtool: compile:  g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/php-opencv -DPHP_ATOM_INC -I/root/php-opencv/include -I/root/php-opencv/main -I/root/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /root/php-opencv/opencv.cc  -fPIC -DPIC -o .libs/opencv.o
/bin/bash /root/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/php-opencv -DPHP_ATOM_INC -I/root/php-opencv/include -I/root/php-opencv/main -I/root/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /root/php-opencv/opencv_exception.cc -o opencv_exception.lo 
libtool: compile:  g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/php-opencv -DPHP_ATOM_INC -I/root/php-opencv/include -I/root/php-opencv/main -I/root/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /root/php-opencv/opencv_exception.cc  -fPIC -DPIC -o .libs/opencv_exception.o
/bin/bash /root/php-opencv/libtool --mode=link cc -DPHP_ATOM_INC -I/root/php-opencv/include -I/root/php-opencv/main -I/root/php-opencv -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2    -o opencv.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/php-opencv/modules  opencv.lo source/opencv2/core/opencv_mat.lo source/opencv2/core/opencv_utility.lo source/opencv2/opencv_imgcodecs.lo opencv_exception.lo source/opencv2/core/hal/opencv_interface.lo source/opencv2/opencv_highgui.lo source/opencv2/imgcodecs/opencv_imgcodecs_c.lo source/opencv2/core/opencv_type.lo source/opencv2/opencv_core.lo source/opencv2/opencv_imgproc.lo source/opencv2/core/opencv_base.lo source/opencv2/core/opencv_persistence.lo source/opencv2/opencv_objdetect.lo source/opencv2/opencv_videoio.lo source/opencv2/opencv_face.lo source/opencv2/face/opencv_facerec.lo source/opencv2/face/opencv_facemarkLBF.lo source/opencv2/core/opencv_cvdef.lo source/opencv2/dnn/opencv_dnn.lo source/opencv2/opencv_ml.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lstdc++ -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core
libtool: link: cc -shared  -fPIC -DPIC  .libs/opencv.o source/opencv2/core/.libs/opencv_mat.o source/opencv2/core/.libs/opencv_utility.o source/opencv2/.libs/opencv_imgcodecs.o .libs/opencv_exception.o source/opencv2/core/hal/.libs/opencv_interface.o source/opencv2/.libs/opencv_highgui.o source/opencv2/imgcodecs/.libs/opencv_imgcodecs_c.o source/opencv2/core/.libs/opencv_type.o source/opencv2/.libs/opencv_core.o source/opencv2/.libs/opencv_imgproc.o source/opencv2/core/.libs/opencv_base.o source/opencv2/core/.libs/opencv_persistence.o source/opencv2/.libs/opencv_objdetect.o source/opencv2/.libs/opencv_videoio.o source/opencv2/.libs/opencv_face.o source/opencv2/face/.libs/opencv_facerec.o source/opencv2/face/.libs/opencv_facemarkLBF.o source/opencv2/core/.libs/opencv_cvdef.o source/opencv2/dnn/.libs/opencv_dnn.o source/opencv2/.libs/opencv_ml.o   -L/usr/local/lib -lstdc++ -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core  -g -O2 -Wl,-rpath -Wl,/usr/local/lib   -Wl,-soname -Wl,opencv.so -o .libs/opencv.so
libtool: link: ( cd ".libs" && rm -f "opencv.la" && ln -s "../opencv.la" "opencv.la" )
/bin/bash /root/php-opencv/libtool --mode=install cp ./opencv.la /root/php-opencv/modules
libtool: install: cp ./.libs/opencv.so /root/php-opencv/modules/opencv.so
libtool: install: cp ./.libs/opencv.lai /root/php-opencv/modules/opencv.la
libtool: finish: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin" ldconfig -n /root/php-opencv/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/php-opencv/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.
$ make install
Installing shared extensions:     /usr/lib/php/20190902/
$ make test
/bin/bash /root/php-opencv/libtool --mode=install cp ./opencv.la /root/php-opencv/modules
libtool: install: cp ./.libs/opencv.so /root/php-opencv/modules/opencv.so
libtool: install: cp ./.libs/opencv.lai /root/php-opencv/modules/opencv.la
libtool: finish: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin" ldconfig -n /root/php-opencv/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/php-opencv/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP         : /usr/bin/php7.4 
PHP_SAPI    : cli
PHP_VERSION : 7.4.13
ZEND_VERSION: 3.4.0
PHP_OS      : Linux - Linux plateforme 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64
INI actual  : /root/php-opencv/tmp-php.ini
More .INIs  :   
CWD         : /root/php-opencv
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2021-01-14 21:10:51
=====================================================================
PASS Check for opencv presence [tests/001.phpt] 
PASS absdiff function test [tests/absdiff.phpt] 
PASS CV add function test [tests/add.phpt] 
PASS Draw circle test [tests/circle.phpt] 
PASS Check for opencv constant [tests/constant.phpt] 
PASS CV test [tests/cv.phpt] 
FAIL DNN::blobFromImage [tests/dnn.phpt] 
PASS Ellipse test [tests/ellipse.phpt] 
PASS LBPHFaceRecognizer [tests/faceRecognizer.phpt] 
PASS LBPHFaceRecognizer with Decode [tests/faceRecognizerDecode.phpt] 
PASS FacemarkLBF::create [tests/facemark.phpt] 
PASS get_structuring_element function test [tests/get_structuring_element.phpt] 
PASS CV magnitude function test [tests/magnitude.phpt] 
PASS Mat __construct [tests/mat.phpt] 
PASS Exception [tests/opencv_exception.phpt] 
PASS ROI test [tests/roi.phpt] 
PASS split test [tests/split.phpt] 
PASS Type test [tests/type.phpt] 
PASS CV\VideoCapture Class test [tests/videoCapture.phpt] 
=====================================================================
TIME END 2021-01-14 21:10:55

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   15
---------------------------------------------------------------------

Number of tests :   19                19
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (  5.3%) (  5.3%)
Tests passed    :   18 ( 94.7%) ( 94.7%)
---------------------------------------------------------------------
Time taken      :    4 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
DNN::blobFromImage [tests/dnn.phpt]
=====================================================================

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.	You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: n
make: *** [Makefile:132: test] Error 1
$ ls -lh | grep opencv
4.3M Jan 14 22:05 opencv.so
$ php -v
PHP 7.4.13 (cli) (built: Nov 30 2020 20:40:09) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
$ apt info php-dev
Package: php-dev
Version: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15
Priority: optional
Section: php
Source: php-defaults (79+0~20201210.30+debian10~1.gbpedaf15)
Maintainer: Debian PHP Maintainers <team+pkg-php@tracker.debian.org>
Installed-Size: 22.5 kB
Depends: php7.4-dev
Download-Size: 7,036 B
APT-Manual-Installed: yes
APT-Sources: https://packages.sury.org/php buster/main amd64 Packages
Description: Files for PHP module development (default)
 Headers and other PHP needed for compiling additional modules.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on latest stable
 PHP version (currently 7.4).

N: There is 1 additional record. Please use the '-a' switch to see it

$ apt info php-cli
Package: php-cli
Version: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15
Priority: optional
Section: php
Source: php-defaults (79+0~20201210.30+debian10~1.gbpedaf15)
Maintainer: Debian PHP Maintainers <team+pkg-php@tracker.debian.org>
Installed-Size: 24.6 kB
Depends: php7.4-cli
Download-Size: 7,104 B
APT-Sources: https://packages.sury.org/php buster/main amd64 Packages
Description: command-line interpreter for the PHP scripting language (default)
 This package provides the /usr/bin/php command interpreter, useful for
 testing PHP scripts from a shell or performing general shell scripting tasks.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on latest stable
 PHP version (currently 7.4).

N: There is 1 additional record. Please use the '-a' switch to see it

phpize

you did phpize but i asked phpize --clean

i couldn't compile php-opencv on debian 10 with opencv 4.5.0 because i had error debian 10 has max version GLIBCXX_3.4.25 but opencv 4.5.0 requires GLIBCXX_3.4.26:

PHP Warning: PHP Startup: Unable to load dynamic library 'opencv.so' (tried: /php-opencv/modules/opencv.so (/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/libopencv_gapi.so.4.5)), /php-opencv/modules/opencv.so.so (/php-opencv/modules/opencv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

so i tried opencv 4.0.1 and it works wery well:

git clone https://github.com/php-opencv/php-opencv-examples.git && cd php-opencv-examples && php classify_image_by_dnn_mobilenet.php

Cloning into 'php-opencv-examples'...
87%: Egyptian cat
4%: tabby, tabby cat
2%: tiger cat
0%: odometer, hodometer, mileometer, milometer
0%: motor scooter, scooter

you can check commands:
https://github.com/php-opencv/php-opencv-examples/blob/master/docker/debian-10.7_php-7.4_opencv-4.0.1/Dockerfile

also i noticed that we have same version of php packages but different version of php:
screenshot_2021-01-15_03:21:45
screenshot_2021-01-15_03:22:06
screenshot_2021-01-15_03:22:23

so show me

apt list --installed | grep php

and

apt list --installed | grep opencv

commented

you did phpize but i asked phpize --clean

I did phpize --clean && phpize as you asked, but no output from phpize --clean, so I didn't mention.

Before installing php-opencv, I installed OpenCV 4.5 following this guide: https://linuxize.com/post/how-to-install-opencv-on-debian-10/. I was able to compile. As I understood, it is required for php-opencv to run, is this correct or not at all?

So my next steps are:

  • uninstalling OpenCV 4.5 (make uninstall)
  • install OpenCV 4.0.1

Right? Thanks again for your help.

# apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php7.4/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php-cli/stable,now 2:7.3+69 all [installed,upgradable to: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15]
php-common/stable,now 2:69 all [installed,upgradable to: 2:79+0~20201210.30+debian10~1.gbpedaf15]
php-dev/unknown,now 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15 all [installed]
php-json/stable,now 2:7.3+69 all [installed,upgradable to: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15]
php-mbstring/stable,now 2:7.3+69 all [installed,upgradable to: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15]
php-mysql/stable,now 2:7.3+69 all [installed,upgradable to: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15]
php-pear/unknown,now 1:1.10.12+submodules+notgz-1+0~20201204.17+debian10~1.gbp545cab all [installed,automatic]
php-zip/stable,now 2:7.3+69 all [installed,upgradable to: 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15]
php7.3-bcmath/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-cli/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-common/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-curl/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-gd/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-json/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-mbstring/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-mysql/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-opcache/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-readline/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-xml/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.3-zip/stable,stable,now 7.3.19-1~deb10u1 amd64 [installed,upgradable to: 7.3.26-1+0~20210112.74+debian10~1.gbpd78724]
php7.4-bcmath/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-cli/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-common/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-curl/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-dev/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-gd/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-json/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-mbstring/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-mysql/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-opcache/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-readline/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-xml/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4-zip/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 amd64 [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php7.4/now 7.4.13-1+0~20201130.33+debian10~1.gbpd59941 all [installed,upgradable to: 7.4.14-1+0~20210112.34+debian10~1.gbpaa175a]
php/unknown,now 2:7.4+79+0~20201210.30+debian10~1.gbpedaf15 all [installed]
pkg-php-tools/stable,now 1.37 all [installed,automatic]
# apt list --installed | grep opencv

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libopencv-calib3d3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-contrib3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-core3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-features2d3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-flann3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-highgui3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-imgcodecs3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-imgproc3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-ml3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-objdetect3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-photo3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-shape3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-stitching3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-superres3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-video3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-videoio3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-videostab3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
libopencv-viz3.2/stable,now 3.2.0+dfsg-6 amd64 [installed,auto-removable]
opencv/now 4.5.0-1 amd64 [installed,local]

libopencv-ml3.2
libopencv-calib3d3.2
opencv

you have opencv (all libs in one packege) 4.5.0 and same libs in seperate packages but version 3.2.0.
please delete all libs in separate packages. because you compile php-opencv with libs from opencv package but when try to use - system use separate libs. so you have "symbol error".

php7.4-cli/now 7.4.13
php-dev/unknown,now 2:7.4
php-cli/stable,now 2:7.3

you have php 7.3 and 7.4
please remove 7.3 if you don't use it

commented

Ok thanks, I did all the cleanup:

  • apt autoremove // removed all opencv 3.2 libraries
  • apt purge php7.3*
  • cd /php-opencv && phpize --clean && phpize && ./configure --with-php-config=/usr/bin/php-config && make && make install

Still the same error. Do you think I will have other results with OpenCV 4.0?

yes, you can try.
I have precompiled package opencv 4.0.1 https://github.com/php-opencv/php-opencv-packages
so you need remove opencv 4.5.0, install 4.0.1 and recompile php-opencv

also you can show me:

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

commented

I confirm it works perfectly with OpenCV 4.0.1.

Thanks.