如何从/var/tmp更改默认的Pear/PECL构建文件夹?

时间:2021-02-18 07:13:00

I'm trying to install a PECL package on Linux, but the installer never gets past the configure stage.

我正在尝试在Linux上安装一个PECL包,但是安装程序从来没有经过配置阶段。

My hosting provider mounted a file system at /var/tmp that prevents files from executing, and that's causing this error:

我的主机提供商安装了一个文件系统在/var/tmp,阻止文件执行,这导致了这个错误:

root@host [/usr/local/apache/conf/includes]# pecl install pdo
downloading PDO-1.0.3.tgz ...
Starting to download PDO-1.0.3.tgz (52,613 bytes)
.............done: 52,613 bytes
12 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
building in /var/tmp/pear-build-root/PDO-1.0.3
running: /root/tmp/pear/PDO/configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/root/tmp/pear/PDO/configure' failed

I'm 99% sure the problem is that you can't execute files in /var/tmp (I copied an executable file over here and tried it to verify). I'm sure I can get PECL to complete if I have it do its build work somewhere else, but I can't find the appropriate configuration setting.

我确信99%的问题是您不能在/var/tmp中执行文件(我在这里复制了一个可执行文件并尝试验证它)。我确信如果让PECL在别的地方做构建工作,我就可以完成它,但是我找不到合适的配置设置。

How do you tell PECL to build in a non-default folder?

如何告诉PECL在非默认文件夹中构建?

3 个解决方案

#1


2  

Whoa, why are you installing PDO from PECL? PDO has been built in to PHP since 5.1. Are you running 5.0?

你为什么要在PECL上安装PDO ?从5.1开始,PHP就内置了PDO。你运行5.0吗?

If you're running 5.1 or higher and are missing PDO, chances are that:

如果你跑5.1或更高,而错过了PDO,很可能是:

  1. Your copy of PHP was compiled without it, and must be recompiled; or
  2. 您的PHP副本是在没有它的情况下编译的,必须重新编译;或
  3. Your copy of PHP was installed from your OS's repository without the PDO module
  4. 您的PHP副本是从OS的存储库中安装的,没有PDO模块

If 1, you'll need to either recompile PHP from scratch, or compile just the shared module and copy it to the correct location.

如果是1,则需要从头重新编译PHP,或者只编译共享模块并将其复制到正确的位置。

If 2, you'll just need to install your OS's PDO extension. Under RHEL and CentOS, try yum search php-pdo. I don't know the proper syntax for calling the package installer for other distros, but the package will almost certainly include the string "php-pdo". (Tip: If you got your PHP from your OS, they also might provide common PECL packages. Try searching for "pecl" in their repositories.)

如果是2,您只需要安装OS的PDO扩展。在RHEL和CentOS之下,试试yum搜索php-pdo。我不知道调用其他发行版的包安装程序的正确语法,但是包几乎肯定会包含字符串“php-pdo”。(提示:如果您的PHP来自您的操作系统,那么它们也可能提供普通的PECL包。尝试在他们的存储库中搜索“pecl”。

Finally, if you're running 5.0... for the sake of all that is good in this world, upgrade! Read through the upgrade notes in the PHP manual first, just in case you're using old behavior by accident.

最后,如果您正在运行5.0……为了世界上所有美好的事物,升级吧!首先阅读PHP手册中的升级说明,以防您偶然使用旧的行为。

(Also, to reconfigure pecl, try pecl config-show to see what settings are available, followed by a pecl config-set ... to change a setting. Do not try to install the PDO extension for a version of PHP newer than 5.0.x, it will break. There's even a big fat box at the top of the PDO page on the PECL site.)

(另外,要重新配置pecl,请尝试pecl config-show查看哪些设置是可用的,然后是pecl config-set……)改变设置。不要尝试为比5.0更新的PHP版本安装PDO扩展。x,它将打破。在PECL网站的PDO页面顶部甚至有一个大的胖框。

#2


2  

The answers above may help the user, but not those that run into the "noexec" problem with the /tmp dir.

上面的答案可以帮助用户,但是不能帮助遇到/tmp dir的“noexec”问题的用户。

Here's how to pecl install [program] when it fails with "configure error cannot run c compiled programs" because you cannot execute stuff in the /tmp directory:

以下是如何在“配置错误无法运行c编译程序”失败时pecl install [program],因为您无法在/tmp目录中执行内容:

First remount the /tmp directory with the exec option turned on: mount -o,remount,rw,exec /tmp

首先,打开exec选项重新挂载/tmp目录:挂载-o、重新挂载、rw、exec /tmp

Second, install your pecl extention: pecl install [extention name]

第二,安装pecl扩展:pecl安装[扩展名]

Third, once you are done you should set it back to 'noexec' using: mount -o,remount,rw,noexec /tmp

第三,一旦完成,您应该使用:mount -o、remount、rw、noexec /tmp将其设置为“noexec”

#3


0  

In my case /tmp is noexec, /var is executable.

在我的例子中/tmp是noexec, /var是可执行的。

main10:~# mv /tmp/pear /var/tmp

main10:~# ln -s /var/tmp/pear /tmp/pear

It solved the problem.

它解决了这个问题。

#1


2  

Whoa, why are you installing PDO from PECL? PDO has been built in to PHP since 5.1. Are you running 5.0?

你为什么要在PECL上安装PDO ?从5.1开始,PHP就内置了PDO。你运行5.0吗?

If you're running 5.1 or higher and are missing PDO, chances are that:

如果你跑5.1或更高,而错过了PDO,很可能是:

  1. Your copy of PHP was compiled without it, and must be recompiled; or
  2. 您的PHP副本是在没有它的情况下编译的,必须重新编译;或
  3. Your copy of PHP was installed from your OS's repository without the PDO module
  4. 您的PHP副本是从OS的存储库中安装的,没有PDO模块

If 1, you'll need to either recompile PHP from scratch, or compile just the shared module and copy it to the correct location.

如果是1,则需要从头重新编译PHP,或者只编译共享模块并将其复制到正确的位置。

If 2, you'll just need to install your OS's PDO extension. Under RHEL and CentOS, try yum search php-pdo. I don't know the proper syntax for calling the package installer for other distros, but the package will almost certainly include the string "php-pdo". (Tip: If you got your PHP from your OS, they also might provide common PECL packages. Try searching for "pecl" in their repositories.)

如果是2,您只需要安装OS的PDO扩展。在RHEL和CentOS之下,试试yum搜索php-pdo。我不知道调用其他发行版的包安装程序的正确语法,但是包几乎肯定会包含字符串“php-pdo”。(提示:如果您的PHP来自您的操作系统,那么它们也可能提供普通的PECL包。尝试在他们的存储库中搜索“pecl”。

Finally, if you're running 5.0... for the sake of all that is good in this world, upgrade! Read through the upgrade notes in the PHP manual first, just in case you're using old behavior by accident.

最后,如果您正在运行5.0……为了世界上所有美好的事物,升级吧!首先阅读PHP手册中的升级说明,以防您偶然使用旧的行为。

(Also, to reconfigure pecl, try pecl config-show to see what settings are available, followed by a pecl config-set ... to change a setting. Do not try to install the PDO extension for a version of PHP newer than 5.0.x, it will break. There's even a big fat box at the top of the PDO page on the PECL site.)

(另外,要重新配置pecl,请尝试pecl config-show查看哪些设置是可用的,然后是pecl config-set……)改变设置。不要尝试为比5.0更新的PHP版本安装PDO扩展。x,它将打破。在PECL网站的PDO页面顶部甚至有一个大的胖框。

#2


2  

The answers above may help the user, but not those that run into the "noexec" problem with the /tmp dir.

上面的答案可以帮助用户,但是不能帮助遇到/tmp dir的“noexec”问题的用户。

Here's how to pecl install [program] when it fails with "configure error cannot run c compiled programs" because you cannot execute stuff in the /tmp directory:

以下是如何在“配置错误无法运行c编译程序”失败时pecl install [program],因为您无法在/tmp目录中执行内容:

First remount the /tmp directory with the exec option turned on: mount -o,remount,rw,exec /tmp

首先,打开exec选项重新挂载/tmp目录:挂载-o、重新挂载、rw、exec /tmp

Second, install your pecl extention: pecl install [extention name]

第二,安装pecl扩展:pecl安装[扩展名]

Third, once you are done you should set it back to 'noexec' using: mount -o,remount,rw,noexec /tmp

第三,一旦完成,您应该使用:mount -o、remount、rw、noexec /tmp将其设置为“noexec”

#3


0  

In my case /tmp is noexec, /var is executable.

在我的例子中/tmp是noexec, /var是可执行的。

main10:~# mv /tmp/pear /var/tmp

main10:~# ln -s /var/tmp/pear /tmp/pear

It solved the problem.

它解决了这个问题。