12

Having some issues with pecl yaml in PHP7 (see below for error log). What I can see on: https://pecl.php.net/package/yaml is that there's some RC's for 2.0 that is suppose to cover the issue... I'm currently running the command:

pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini. 

But guess this won't install the RC version. How do I install the RC? is there a parameter to supply maybe..?

I could google the following solution (not tested):

pear config-set preferred_state beta

But I guess that this will set a global beta state for all extensions. I only want to install this extension as beta..


Error log

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
Community
  • 1
  • 1
superhero
  • 6,281
  • 11
  • 59
  • 91

3 Answers3

17

So after some additional googling I found how to install by searching for how to install beta packages, instead of RC's as I first was looking for.. face-palm

http://php.net/manual/en/install.pecl.pear.php

..so the correct command would be:

pecl install yaml-beta && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini


Stable 2.0.0 was released 2016-09-24. Version 1.x.x is still supported, so you need to specify the version number, eg:

pecl install yaml-2.0.0 && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini

Find latest release at https://pecl.php.net/package/yaml

superhero
  • 6,281
  • 11
  • 59
  • 91
  • Do you mean >> not >? – Shaun Oct 07 '16 at 21:24
  • 1
    @ShaunF One or the other, don't matter in this context. The file don't exist and you need to create it. If you like to use ">>" it will accomplish the same in this context. – superhero Oct 08 '16 at 04:26
  • 2
    I had solved this with `yaml-beta` earlier (and upvoted the answer), but recently I got the error again, and it was fixed with `yaml-2.0.0` (as in the edited answer) – Shadi Nov 14 '16 at 07:43
3

On ubuntu 16.04 (PHP 7.0), you can do this :

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 is needed to use the pecl command
  • php-dev is needed for the phpize command (used by pecl)
  • libyaml-dev is needed for... the yaml library
alphayax
  • 2,930
  • 2
  • 25
  • 25
  • 1
    I was using `pecl install yaml` and I just changed to `pecl install yaml-2.0.0` and it worked, thanks – santiago arizti Jun 09 '17 at 18:54
  • ... but my php says yaml functions are not available, the phpinfo doesnt show any yaml extension... – santiago arizti Jun 09 '17 at 19:09
  • 1
    ok, found the reason why... there was no conf.d file added to the appropriate folder... follow these instructions if you are in the same situation as I am: https://forum.phalconphp.com/discussion/13753/config-yaml-in-php-7 – santiago arizti Jun 09 '17 at 19:21
2

so far so good the answer wasn't working on my Centos 7 PHP 7.

but I figure how to do it :

yum install php70w-devel php70w-pear zlib-devel curl-devel gcc
yum install libyaml-devel
pecl install yaml-beta

I hope that will help others using Centos too.

JOduMonT
  • 171
  • 6