简体   繁体   English

如何使用 make 从 tgz 文件构建一个 php 扩展名?

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

Background背景

I use a RedHat machine without root access, no access to the yum packet manager and no Docker support.我使用没有 root 访问权限的 RedHat 机器,无法访问 yum 数据包管理器,也没有 Docker 支持。 This is the policy unfortunately at my work.不幸的是,这是我工作中的政策。

I have configured Apache and PHP using a tar file in a folder.我已经使用文件夹中的 tar 文件配置了 Apache 和 PHP。 Also done same for MongoDB, now I try to configure the PHP drivers for MongoDB according to these instructions:也为 MongoDB 做了同样的事情,现在我尝试根据这些说明为 MongoDB 配置 PHP 驱动程序:

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

However I get stuck on the first bullet:但是我卡在了第一颗子弹上:

sudo pecl install mongodb

Problem问题

Do I need PECL?我需要 PECL 吗? Can the extension be downloaded manually, and added to PHP?可以手动下载扩展,添加到PHP吗?

I have tried to download the mongodb extension manually from: https://pecl.php.net/package/mongodb我尝试从以下网址手动下载 mongodb 扩展: https://pecl.php.net/package/mongodb

How to compile it mongodb.so?如何编译它 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).我试图在我有 root 访问权限的机器上运行 pecl,然后我看到它下载了 mongodb-1.10.0.tgz 并运行 make(安装时在 output 中)。

When I unpack the tgz file manually, I am not able to run make.当我手动解压 tgz 文件时,我无法运行 make。 How to use the makefile.frag?如何使用 makefile.frag? How to run make?如何运行 make?

Here is a link on how to build mongodb.so: https://www.php.net/manual/en/mongodb.installation.manual.php这是有关如何构建 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:您还可以使用以下命令解压 mongodb-1.10.0.tgz 文件:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM