2

My goals is to be able to use the PHP functions for parsing YAML detailed in the PHP docs: http://php.net/manual/en/ref.yaml.php

To install the PECL yaml extension I've opened Terminal and typed:

brew install libyaml

Then

sudo /usr/local/php5/bin/pecl install pecl_http

Then

sudo /usr/local/php5/bin/pecl install yaml

But I think it fails to install the PECL yaml extension. It says:

3 warnings and 16 errors generated.
make: *** [yaml.lo] Error 1
ERROR: `make' failed

And when I try to use yaml_parse_file() in my program, it says:

Fatal error: Call to undefined function yaml_parse_file()

How do I properly install the PECL yaml extension so I can use the PHP functions for parsing YAML?

plooms
  • 93
  • 2
  • 11

1 Answers1

3

I had similar issue and below steps helped me.

First be sure you have installed yaml extension (as I know since brew will not help us for packages so better to use pecl)

Even though some errors (such as failed for mkdir) occurred during installation it was completed.

pecl install yaml

Next open your php.ini file and add this line according to your path to yaml.so file.

extension=/usr/local/Cellar/php70-yaml/2.0.0/yaml.so

Hope it helps..

İsmail Atkurt
  • 1,360
  • 1
  • 12
  • 17
  • 1
    After my upgrade to php 7.4, ext-yaml was installed, but somehow not working. Out of laziness I simply did `pecl uninstall yaml`and then again `pecl install yaml`- worked well ;). – Andreas Jan 09 '20 at 00:38