在PHP7 中遇到pecl yaml的一些问题(参见下面的错误日志)。我能看到的是:https://pecl.php.net/package/yaml是有一些关于2.0的RC用于解决这个问题...我目前正在运行命令:
pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini.
但是猜测这不会安装RC版本。 如何安装RC?是否有供应的参数..?
我可以谷歌以下解决方案(未经测试):
pear config-set preferred_state beta
但我想这会为所有扩展设置全局测试状态。我只想将此扩展程序安装为测试版..
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuserPVGidl/yaml-1.2.0/libtool --mode=compile cc -I. -I/tmp/pear/temp/yaml -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserPVGidl/yaml-1.2.0/include -I/tmp/pear/temp/pear-build-defaultuserPVGidl/yaml-1.2.0/main -I/tmp/pear/temp/yaml -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yaml/yaml.c -o yaml.lo
mkdir .libs
cc -I. -I/tmp/pear/temp/yaml -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserPVGidl/yaml-1.2.0/include -I/tmp/pear/temp/pear-build-defaultuserPVGidl/yaml-1.2.0/main -I/tmp/pear/temp/yaml -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yaml/yaml.c -fPIC -DPIC -o .libs/yaml.o
In file included from /tmp/pear/temp/yaml/yaml.c:35:0:
/tmp/pear/temp/yaml/php_yaml.h:56:40: fatal error: ext/standard/php_smart_str.h: No such file or directory
#include <ext/standard/php_smart_str.h>
^
compilation terminated.
Makefile:195: recipe for target 'yaml.lo' failed
make: *** [yaml.lo] Error 1
ERROR: `make' failed
答案 0 :(得分:17)
所以经过一些额外的Google搜索后,我找到了如何通过搜索如何安装测试版软件包来安装,而不是像我最初寻找的那样安装.. face-palm 强>
http://php.net/manual/en/install.pecl.pear.php
<击> ..所以正确的命令是:
pecl install yaml-beta && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini
击> <击> 撞击>
稳定的2.0.0于2016-09-24发布。仍支持版本1.x.x,因此您需要指定版本号,例如:
pecl install yaml-2.0.0 && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini
查找最新版本
答案 1 :(得分:2)
到目前为止,答案还不是 Centos 7 PHP 7 。
但我想办法怎么做:
yum install php70w-devel php70w-pear zlib-devel curl-devel gcc
yum install libyaml-devel
pecl install yaml-beta
我希望这也会帮助其他人使用Centos。
答案 2 :(得分:2)
在ubuntu 16.04(PHP 7.0)上,您可以这样做:
apt install libyaml-dev php-dev php-pear
pecl install yaml-2.0.0
echo "extension=yaml.so" > /etc/php/7.0/cli/conf.d/20-yaml.ini
echo "extension=yaml.so" > /etc/php/7.0/apache2/conf.d/20-yaml.ini
php-pear
需要使用pecl
命令php-dev
是phpize
命令(由pecl使用)所必需的
... yaml library 需要libyaml-dev