How to build a php extensions from tgz file using make?

Viewed 150

Background

I use a RedHat machine without root access, no access to the yum packet manager and no Docker support. This is the policy unfortunately at my work.

I have configured Apache and PHP using a tar file in a folder. Also done same for MongoDB, now I try to configure the PHP drivers for MongoDB according to these instructions:

https://docs.mongodb.com/drivers/php/

However I get stuck on the first bullet:

sudo pecl install mongodb

Problem

Do I need PECL? Can the extension be downloaded manually, and added to PHP?

I have tried to download the mongodb extension manually from: https://pecl.php.net/package/mongodb

How to compile it mongodb.so? I tried to run pecl on a machine where I have root access then I saw it downloaded the mongodb-1.10.0.tgz and run make (in output when installing).

When I unpack the tgz file manually, I am not able to run make. How to use the makefile.frag? How to run make?

1 Answers

Here is a link on how to build mongodb.so: https://www.php.net/manual/en/mongodb.installation.manual.php

git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver
git submodule update --init
phpize
./configure
make all
sudo make install

You can also unpack the mongodb-1.10.0.tgz file with:

tar -xvf mongodb-1.10.0.tgz
phpize
make all
sudo make install
Related