구성: 오류: libyaml을 설치하세요.

구성: 오류: libyaml을 설치하세요.

나는 설치를 따르고있다PHP의 YAML 구문 분석 기본 사항Fedora 20에 PHP용 YAML을 설치하려면

나는 다음 단계를 모두 거쳤습니다.

wget http://pecl.php.net/get/yaml-1.1.0.tgz
tar -xvzf yaml-1.1.0.tgz
cd yaml-1.1.0
phpize
./configure && make && make install

그러나 마지막 것은 작동하지 않습니다:

# ./configure && make && make install
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
.../...
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable LibYAML suppot... yes, shared
checking for yaml headers... not found
configure: error: Please install libyaml

"libyaml을 설치해주세요"라는 메시지가 나오면서 설치가 되었는지 확인해 보니... 설치가 되었습니다!

# yum list installed | grep yaml
libyaml.x86_64                         0.1.6-1.fc20                    @updates 
yaml-cpp03.x86_64                      0.3.0-4.fc20                    @anaconda

물론 를 호출하여 PHP 파일을 생성하면 yaml_parse_file()오류가 발생합니다.

Fatal error: Call to undefined function yaml_parse_file() in XXXfile on line YYY

무엇이 누락될 수 있나요?

답변1

libyaml이 아닌 libyaml-dev를 설치해야 합니다. CentOS에서는 sudo yum install -y libyaml-devel.x86_64.

[vagrant@localhost yaml-1.2.0]$ yum search libyaml
============================================
N/S Matched: libyaml
============================================
libyaml-devel.i686 : Development files for LibYAML applications
libyaml-devel.x86_64 : Development files for LibYAML applications
libyaml.i686 : YAML 1.1 parser and emitter written in C
libyaml.x86_64 : YAML 1.1 parser and emitter written in C

답변2

아, 이대로 끝내려고 한 건 아니었는데, 해결 방법을 찾았어요.Pecl로 설치하는 방법Code Google의 문서:

  • 원하는 방법을 사용하여 LibYAML을 설치합니다. 예를 들어 Ubuntu 시스템에서는 sudo apt-get install libyaml-dev필요한 것을 얻을 수 있습니다.
  • sudo pecl install yaml-beta
  • php.ini 설정을 편집하고 추가하세요.extension=yaml.so
  • 그것이 작동했는지 확인하십시오php --re yaml

저는 Fedora를 사용하고 있으므로 약간 다른 접근 방식을 사용해야 했습니다.

# yum search yaml | grep -i php
php-symfony-YAML.noarch : The Symfony YAML Component
php-pecl-yaml.x86_64 : PHP Bindings for yaml
php-symfony-yaml.noarch : Symfony Yaml Component
php-symfony2-Yaml.noarch : Symfony2 Yaml Component
php54-php-pecl-yaml.x86_64 : PHP Bindings for yaml
php56-php-pecl-yaml.x86_64 : PHP Bindings for yaml
syck.i686 : YAML for C, Python, and PHP
syck.x86_64 : YAML for C, Python, and PHP
syck-php.x86_64 : YAML module for php

그래서 나는 다음을 설치했습니다 php-pecl-yaml.x86_64.

# yum install php-pecl-yaml.x86_64

파일 에 해당 줄을 추가하고 php.ini만약을 대비해 아파치를 다시 시작했으며 이제 다음에서 좋은 출력을 얻습니다.

# php --re yaml
Extension [ <persistent> extension #16 yaml version 1.1.1 ] {

  - Dependencies {
    Dependency [ date (Optional) ]
  }

  - INI {
    Entry [ yaml.decode_binary <ALL> ]
      Current = '0'
    }
    Entry [ yaml.decode_timestamp <ALL> ]
      Current = '0'
    }
    Entry [ yaml.output_canonical <ALL> ]
      Current = '0'

    .../...

    Function [ <internal:yaml> function yaml_emit_file ] {

      - Parameters [5] {
        Parameter #0 [ <required> $filename ]
        Parameter #1 [ <required> $data ]
        Parameter #2 [ <optional> $encoding ]
        Parameter #3 [ <optional> $linebreak ]
        Parameter #4 [ <optional> array $callbacks ]
      }
    }
  }
}

관련 정보