Problems with PHP YAML within Travis CI

 ̄綄美尐妖づ 提交于 2019-12-23 20:07:17

问题


Edit: I believe the problem is that YAML doesn't work on 5.4/5.5.

I have a library that is setup in Travis CI and that uses the PHP YAML PECL extension. However, I am unable to get the YAML extension to work in Travis & PHP 5.4, and I'm curious if anyone else has? No amount of Googling has solved my problem.

Here is the output of Travis:

$ git clone --depth=50 --branch="master" git://github.com/titon/IO.git titon/IO

Cloning into 'titon/IO'...

remote: Counting objects: 531, done.

remote: Compressing objects: 100% (256/256), done.

remote: Total 531 (delta 267), reused 460 (delta 196)

Receiving objects: 100% (531/531), 79.41 KiB, done.

Resolving deltas: 100% (267/267), done.

$ cd titon/IO
git.2

$ git checkout -qf 3940a6673413da224eeaaebbc6a98167e4feda38

$ phpenv global 5.4

$ php --version

PHP 5.4.13 (cli) (built: Mar 31 2013 06:18:12)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
before_script.1

$ sudo apt-get install libyaml-dev

Reading package lists... Done

Building dependency tree

Reading state information... Done

libyaml-dev is already the newest version.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ pecl install yaml

downloading yaml-1.1.0.tgz ...

Starting to download yaml-1.1.0.tgz (35,916 bytes)

..........done: 35,916 bytes

9 source files, building

WARNING: php_bin /home/travis/.phpenv/versions/5.4.13/bin/php appears to have a prefix ., but config variable php_prefix does not match

WARNING: php_bin /home/travis/.phpenv/versions/5.4.13/bin/php appears to have a suffix env/versions/5.4.13/bin/php, but config variable php_suffix does not match

running: phpize

Configuring for:

PHP Api Version: 20100412

Zend Module Api No: 20100525

Zend Extension Api No: 220100525

Please provide the prefix of libyaml installation [autodetect] : (Waits until it times out)

The travis.yml in question: https://github.com/titon/IO/blob/master/.travis.yml


回答1:


Automating PECL installs is a problem that is encountered not just on Travis CI. In this case, a pseudo-expect script can be created by sending a cariage return into the stdin of the PECL installer which will in turn pass it on to the configure script that is prompting for input:

printf "\n" | pecl install yaml

A working version of your .travis.yml would then look something like:

language: php

php:
  - 5.4
  - 5.5

before_script:
  - printf "\n" | pecl install yaml-beta
  - echo "extension=yaml.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  - composer install --dev

notifications:
  email: false



回答2:


.travis.ci

language: php

php:
  - 5.4
  - 5.5
  - 5.6

sudo:
  false

before_install:
  - pecl channel-update pecl.php.net
  - (CFLAGS="-O1 -g3 -fno-strict-aliasing"; pecl install yaml < /dev/null &)

addons:
  apt:
    packages:
      - libyaml-dev


来源:https://stackoverflow.com/questions/15995009/problems-with-php-yaml-within-travis-ci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!