Compile PHP static binary

I need a static PHP binary that has:

- PHP 7

- mysqli

- json

- OpenCV for PHP

The OpenCV installation instructions for PHP can be found here, along with some examples.

[login to view URL]

[login to view URL]

I have attempted it myself, and ALMOST succeeded, but could not get the OpenCV extension to go into the static PHP binary.

Here are my commands for the compile, on a Ubuntu 18.04 instance from Amazon.

# Directory for compile

cd ~

mkdir ~/php-7-bin

# Update packages and install needed compilation dependencies

sudo apt-get install build-essential

sudo apt install -y autoconf automake make make-guile bison build-essential curl flex libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7 libreadline-dev libsqlite3-dev nginx pkg-config re2c sqlite3 zlib1g-dev php7.2-mysql

sudo apt-get install libxml2-dev bzip2

sudo apt-get install libldap2-dev libldap-2.4-2 libtool-bin libzip-dev lbzip2 libxml2-dev bzip2 re2c libbz2-dev apache2-dev libjpeg-dev libxpm-dev libxpm-dev libgmp-dev libgmp3-dev libmcrypt-dev libmysqlclient-dev mysql-server mysql-common libpspell-dev librecode-dev libcurl4-openssl-dev libxft-dev

# if error, run:

sudo apt-get update

sudo apt update

#sudo apt-get install php7.2

# OpenCV

sudo apt install -y pkg-config cmake git php-cli php-dev

git clone [login to view URL]

git clone [login to view URL]

cd opencv_contrib && git checkout tags/4.0.1 && cd ../opencv && git checkout tags/4.0.1

cd .. && mkdir build && cd build


sudo make -j2

sudo make install


cd ~

git clone [login to view URL]

cd php-opencv

sudo phpize

./configure --with-php-config=/usr/bin/php-config

sudo make

sudo make install

# Do I need to do this step? Or can I add the extension direct to the PHP binary?

sudo echo "extension=[login to view URL]" > /etc/php/7.2/cli/conf.d/[login to view URL]

# Compile OpenSSL v1.0.1 from source,

# as Amazon Linux uses a newer version than the Lambda Execution Environment, which

# would otherwise produce an incompatible binary.

cd ~

curl -sL [login to view URL] | tar -xvz

cd openssl-1.0.1k

./config && make && sudo make install

# Download the PHP 7.3.0 source

cd ~

curl -sL [login to view URL]| tar -xvz

cd php-7.3.6

# Compile PHP with OpenSSL 1.0.1 support, and install to /home/ec2-user/php-7-bin

#./configure --prefix=/home/ec2-user/php-7-bin/ --without-pear --enable-mysqlnd --with-pdo-mysql --with-pdo-mysql=mysqlnd --enable-shared=no --enable-static=yes --enable-phar --with-openssl --with-curl --enable-libxml --enable-simplexml --enable-xml --with-mhash --enable-mbstring --enable-sockets --with-mysqli --with-bz2 --enable-zip --with-gd --with-jpeg-dir --enable-exif --with-freetype-dir --with-png-dir --without-libzip --with-zlib --with-zlib-dir --with-opencv

# TRIMMED VERSION because too many errors during configure, however the full version above could be tried because I used apt-get to add a bunch of new dependencies, but never tried the full configure command with those new dependencies.

# if already run a ./configure, remove it using this:

# rm configure && ./buildconf --force

./buildconf --force

./configure --prefix=/home/ec2-user/php-7-bin/ --without-pear --enable-mysqlnd --with-pdo-mysql --with-pdo-mysql=mysqlnd --with-zlib-dir --enable-mbstring --with-libxml-dir --with-gd --enable-exif --with-pdo-mysql --with-mysqli --with-jpeg-dir --with-png-dir --enable-shared --enable-php-opencv

sudo make

sudo make install

# check the result

cd /home/ec2-user/php-7-bin/bin


# check which modules are installed

./php -m

Taidot: Linux, Ubuntu

Näytä lisää: install php mysql windows 2003 server, tringme server type, static nat router server, php script save attachment server, flash php file upload working server, chess php multi player chess server, build php script query game server, ajax php mysql constant check server, static nat cisco server, php excel output sql server, compile php cgi mssql, php script split files server, cisco static nat web server, asp php sql best rated server, godaddy linux server type, build php static pages, litespeed web server compile php, php static type checker

Tietoa työnantajasta:
( 104 arvostelua ) North Ward, Australia

Projektin tunnus: #19924251

Myönnetty käyttäjälle:


I have been using Ubuntu ever since 16.10 and I have learned almost everything about the OS. I could help you get your PHP binary compiled and working.

$45 AUD 7 päivässä
(0 Arvostelua)

6 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


Hi. Do you need a php compiled with opencv statically? I can help you without problems. Open to questions

$35 AUD 1 päivässä
(46 arvostelua)

Good Day. Can help You properly compile and setup this static library for php, which you need. Can be done within short time frame. Tnx and Regards.

$50 AUD 1 päivässä
(27 arvostelua)

⭐Let's discuss ⭐ I 'm a Full-stack developer and Ethical Hacker Working +5 years in programming field. I love programming. My passion is to solve the programming issue. Technology Summary : ---Programming/Languages: PH Lisää

$40 AUD 1 päivässä
(3 arvostelua)

I am experienced in compiling various module in Linux and php with extension. I have 8 years of experience as a Linux System Administrator. I posses good knowledge of mail server like zimbra, sendmail, web server li Lisää

$111 AUD 2 päivässä
(5 arvostelua)

Hi, As a full stack web developer, I have an experience of 12+ years in PHP, Javascritp, and PHP extension (c++). Here are some of my experience using nodejs, expressjs, and laravel. - [login to view URL] (nodejs, Lisää

$222 AUD 3 päivässä
(0 arvostelua)