unable to install in Docker / php:8.0
terrafrost opened this issue · comments
I tried installing this with the following Dockerfile without success:
FROM php:8.0
RUN apt update && apt install -y wget
RUN wget https://raw.githubusercontent.com/php-opencv/php-opencv-packages/master/opencv_4.5.0_amd64.deb && dpkg -i opencv_4.5.0_amd64.deb && rm opencv_4.5.0_amd64.deb
RUN apt-get install -y git
RUN git clone https://github.com/php-opencv/php-opencv.git
RUN cd php-opencv && git checkout php7.4 && phpize && ./configure --with-php-config=/usr/bin/php-config && make && make install
Here's the error I got:
configure: error: Cannot find php-config. Please use --with-php-config=PATH
I've compiled extensions before and have never used the --with-php-config
option before so I tried to remove that and still got an error:
/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'void opencv_mat_update_property_by_c_mat(zval*, cv::Mat*)':
/php-opencv/source/opencv2/core/opencv_mat.cc:53:46: error: cannot convert 'zval*' {aka '_zval_struct*'} to 'zend_object*' {aka '_zend_object*'}
53 | zend_update_property_long(opencv_mat_ce, z, "rows", sizeof("rows")-1, mat->rows);
| ^
| |
| zval* {aka _zval_struct*}
In file included from /usr/local/include/php/main/php.h:35,
Any ideas?
FROM php:8.0
and
RUN cd php-opencv && git checkout php7.4
Any ideas?
PS: If you have problem with creating your own docker file try to use these:
https://github.com/php-opencv/php-opencv-examples/tree/master/docker
If you are using ono of the official php Docker files (For example FROM php:8.0
), the location of php-config is /usr/local/bin/php-config
. So the command to build php-opencv is:
RUN cd php-opencv && phpize && ./configure --with-php-config=/usr/local/bin/php-config && make