我一直尝试安装一些 PECL,但它们都返回相同类型的错误。与时区有关吗?我正在运行 RedHat x86_64 es5。
尝试安装 geoip-1.0.7:
root@server [~]# pecl install geoip-1.0.7
downloading geoip-1.0.7.tgz ...
Starting to download geoip-1.0.7.tgz (9,416 bytes)
.....done: 9,416 bytes
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead in PEAR/Validate.php on line 489
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead in /usr/local/lib/php/PEAR/Validate.php on line 489
3 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
building in /var/tmp/pear-build-root/geoip-1.0.7
running: /root/tmp/pear/geoip/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/geoip/configure' failed
发生了什么事?有谁能帮忙...
答案1
根据我的经验,“pecl install packagename”很少起作用。
我只需下载最新的 pecl tarball、解压缩、phpize(确保编译/安装后 php 在你的路径中)、./configure、make、make install、service php-fpm restart
例如,使用 geo-ip pecl 包,尝试
获得http://pecl.php.net/get/geoip-1.0.8.tgz
cd geoip-1.0.8
phpize
./configure
make
make install
echo "extenstion=geoip.so" >> /path/to/php.ini
sudo service php-fpm|apache restart
编辑:
如果你缺少一个开发包,编译错误会告诉你,然后你
yum 安装 missingpkg-dev
编辑:
您的软件包似乎无法安装的具体原因是它是为不同的系统构建的。一般来说,如果您从源代码进行编译,您会更高兴,因为您知道发生了什么。
答案2
尝试:
mount -o remount,exec,suid /tmp
mount -o remount,exec,suid /var/tmp
答案3
时区警告(您应该通过在 php.ini 中设置时区来更正)与实际问题完全无关,实际问题是“错误:无法运行 C 编译程序”行。您可能没有gcc
和/或没有make
从包管理器安装。yum groupinstall "Development Tools"
或者yum install gcc make
可能会奏效。