尝试为php pecl扩展模块(geoip)构建rpm时找不到.so

时间:2015-10-01 19:16:58

标签: php pear pecl geoip

我正在尝试制作一个RPM,以便在AWS机器上轻松部署geoip php模块。 RPM以及其他RPM将托管在只能由这些计算机访问的私有仓库上。这是我正在使用的软件的要求,所以让它留在我需要它

我的第一次尝试是

$ pecl makerpm geoip
WARNING: "pear makerpm" is no longer available; an improved version is available via "pear make-rpm-spec", which is available by installing PEAR_Command_Packaging

很公平,让我们安装这个PEAR_Command_Packaging交易并继续...

$ pecl install PEAR_Command_Packaging
No releases available for package "pecl.php.net/PEAR_Command_Packaging"
install failed

好的,我可以发誓我被告知要安装它,但让我们试试pear

$ pear install PEAR_Command_Packaging
Failed to download pear/PEAR_Command_Packaging within preferred state "stable", latest release is version 0.3.0, stability "alpha", use "channel://pear.php.net/PEAR_Command_Packaging-0.3.0" to install
install failed

稳定性 alpha 嗯...好吧,让我们看看它们有多活跃! 根据{{​​3}},该项目尚未生效,最后一项活动是在 2012年4月 ...但不会这样做。

关闭该途径后,我会查看pecl命令本身,它似乎提供了下载 build install 。我不想install,因为我只在这里制作RPM,但downloadbuild确实看起来很方便:

$ pecl download geoip-1.0.8
downloading geoip-1.0.8.tgz ...
Starting to download geoip-1.0.8.tgz (10,061 bytes)
.....done: 10,061 bytes
File /home/user/workspace/geoip-rpm-spec/geoip-1.0.8.tgz downloaded

准备建筑......

$ pecl bundle geoip
downloading geoip-1.0.8.tgz ...
Starting to download geoip-1.0.8.tgz (10,061 bytes)
.....done: 10,061 bytes
Package ready at '/home/user/workspace/geoip-rpm-spec/geoip'

现在,我们建立!

$ pecl build geoip/package.xml 
running: phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
building in /var/tmp/pear-build-userttUJNa/geoip-1.0.8
... <snip/>
running: find "/var/tmp/pear-build-userttUJNa/install-geoip-1.0.8" | xargs ls -dils
264791  4 drwxrwxr-x 3 user user  4096 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8
265361  4 drwxrwxr-x 3 user user  4096 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr
265362  4 drwxrwxr-x 3 user user  4096 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr/lib64
265363  4 drwxrwxr-x 3 user user  4096 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr/lib64/php
265409  4 drwxrwxr-x 3 user user  4096 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr/lib64/php/5.6
265444  4 drwxrwxr-x 2 user user  4096 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr/lib64/php/5.6/modules
265358 68 -rwxr-xr-x 1 user user 67772 Oct  1 18:33 /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr/lib64/php/5.6/modules/geoip.so

所以,我应该能够在geoip.so找到我的/var/tmp/pear-build-userttUJNa/install-geoip-1.0.8/usr/lib64/php/5.6/modules/geoip.so,对吧?

$ ls -al /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8
ls: cannot access /var/tmp/pear-build-userttUJNa/install-geoip-1.0.8: No such file or directory
$ ls -al /var/tmp/pear-build-userttUJNa
ls: cannot access /var/tmp/pear-build-userttUJNa: No such file or directory

错误!

build步骤声称创建的.so在哪里?该文件在此机器上没有位置。 我能够得到该死的唯一方法就是运行install命令,但这个不是需要该模块的机器。

我在这里做错了吗?

1 个答案:

答案 0 :(得分:0)

<强> 更新 谷歌搜索结果得到了答案。我在这里使用geoip作为一个例子,因为它正是我正在使用的,但你几乎可以将它用于任何扩展,几乎没有修改。

  1. pecl download geoip-1.0.8下载源代码(或其他扩展程序或其他版本)
  2. pecl bundle geoip提取扩展程序源
  3. cd geoip && phpize切换到源目录并创建autoconf脚本
  4. ./configure --prefix=/home/user/rpmbuild/blah --exec-prefix=/home/user/rpmbuild/bleh配置
  5. make .so现在位于modules目录
  6. 利润!
  7. 这是一种旧的,黑客的方法:

    似乎工作(现在)是运行构建步骤,以便使用configure脚本填充下载的模块,切换到模块目录并运行configure --prefix=some_local_dir然后运行{{ 1}}。 现在我实际上可以看到make文件,但感觉就像一个技巧/解决方法而不是实际的解决方案。