【问题标题】:Problems with PHP YAML within Travis CITravis CI 中的 PHP YAML 问题
【发布时间】:2013-04-06 09:02:34
【问题描述】:

编辑:我认为问题在于 YAML 不适用于 5.4/5.5。

我有一个在 Travis CI 中设置并使用 PHP YAML PECL 扩展的库。但是,我无法让 YAML 扩展在 Travis 和 PHP 5.4 中工作,我很好奇是否还有其他人有?再多的谷歌搜索也无法解决我的问题。

这是 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)

有问题的 travis.yml:https://github.com/titon/IO/blob/master/.travis.yml

【问题讨论】:

    标签: php yaml pecl travis-ci


    【解决方案1】:

    自动化 PECL 安装是一个不仅在 Travis CI 上遇到的问题。在这种情况下,可以通过将回车发送到 PECL 安装程序的标准输入来创建伪expect 脚本,然后将其传递给提示输入的配置脚本:

    printf "\n" | pecl install yaml
    

    您的 .travis.yml 的工作版本将如下所示:

    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
    

    【讨论】:

    • 我注意到您在 Github 上的测试,非常感谢您的帮助!我尝试将其移植到我的项目中,但是当它尝试运行 bash 脚本时继续出现权限被拒绝错误。不知道从这里做什么。 github.com/titon/IO
    • @MilesJohnson 您的 bin/travis-yaml.sh 没有在其文件权限中设置执行位。您需要 chmod a+x bin/travis-yaml.sh; git add .; git commit 以便在 Travis 克隆存储库时将该文件标记为可执行文件。
    • 是的,我试过了,但我在 Windows 上,所以它永远不会工作。我将不得不在另一场比赛中试一试。
    • 在 windows(或 unix)上,您可以直接使用 git 设置权限:git update-index --chmod=+x bin/travis-yaml.sh; git commit
    • 你不需要附加到before_script中的php.ini。扩展是自动启用的,可以看到here
    【解决方案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
    

    【讨论】:

    • 我认为不需要addons 部分。 My build 找到没有它的 yaml 开发文件。
    猜你喜欢
    • 2012-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-28
    • 2019-01-26
    • 2017-06-30
    • 2018-12-22
    相关资源
    最近更新 更多