우분투 PECL yaml 설치

PECL yaml 설치
Call to undefined function yaml_parse_file()
Call to undefined function yaml_emit()
PHP Fatal error: Uncaught Error: Call to undefined function yaml_emit()

1 사전작업[ | ]

(필요시) 리눅스 php-devel 설치
(필요시) 리눅스 libyaml-devel 설치
  • 우분투 16, PHP 7
apt-get install php-pear php-dev libyaml-dev
  • 우분투 14, PHP 5
apt-get install php-pear php5-dev

2 확인[ | ]

root@zetawiki:~# php -m | grep yaml
root@zetawiki:~# php -r "yaml_emit();"
PHP Fatal error:  Call to undefined function yaml_emit() in Command line code on line 1
root@zetawiki:~# pecl list yaml
`yaml' not installed
root@zetawiki:~# pecl search yaml
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
yaml    1.3.0 (stable)        YAML-1.1 parser and emitter

3 설치[ | ]

pecl install yaml
#pecl install yaml-2.0.0
root@zetawiki:~# pecl install yaml
downloading yaml-1.2.0.tgz ...
Starting to download yaml-1.2.0.tgz (38,606 bytes)
..........done: 38,606 bytes
9 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Please provide the prefix of libyaml installation [autodetect] :
... (생략)
Build process completed successfully
Installing '/usr/lib/php5/20121212/yaml.so'
install ok: channel://pecl.php.net/yaml-1.2.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=yaml.so" to php.ini

4 so 파일 등록[ | ]

  • 우분투
root@zetawiki:~# php -i | grep Scan
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
root@zetawiki:~# pushd /etc/php5/cli/conf.d
/etc/php5/cli/conf.d ~
root@zetawiki:/etc/php5/cli/conf.d# echo "extension=yaml.so" > yaml.ini
root@zetawiki:/etc/php5/cli/conf.d# php -i | grep yaml.ini
/etc/php5/cli/conf.d/yaml.ini
root@zetawiki:/etc/php5/cli/conf.d# popd
~
root@zetawiki:~#
  • CentOS
[root@zetawiki ~]# php -i | grep Scan
Scan this dir for additional .ini files => /etc/php.d
[root@zetawiki ~]# echo "extension=yaml.so" > /etc/php.d/yaml.ini
[root@zetawiki ~]# cat /etc/php.d/yaml.ini
extension=yaml.so
[root@zetawiki ~]# php -i | grep yaml.ini
/etc/php.d/yaml.ini,

5 확인 2[ | ]

root@zetawiki:~# pecl list | grep yaml
yaml    1.3.0   stable
root@zetawiki:~# php -m | grep yaml
yaml
root@zetawiki:~# php -r "yaml_emit();"
PHP Warning:  yaml_emit() expects at least 1 parameter, 0 given in Command line code on line 1

6 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}