dtdvlazd56637 2014-05-14 17:24
浏览 92

使用Vagrant和puphpet为PHP启用pthreads

I've been trying to enable the pthreads extension in Vagrant. I've generated the Vagrantfile via puphpet and selected pthreads in the PECL section. When I do vagrant up, it says that everything was ok, but when I run php -m in the virtual machine the extension is missing and the classes aren't available.

If I do vagrant ssh and try to install pthreads manually, I got the following error:

$ sudo pecl install pthreads
downloading pthreads-2.0.7.tgz ...
Starting to download pthreads-2.0.7.tgz (77,570 bytes)
..................done: 77,570 bytes
34 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
building in /tmp/pear/temp/pear-build-rootS6s2Hq/pthreads-2.0.7
running: /tmp/pear/temp/pthreads/configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
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... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable Threading API... yes, shared
checking whether to enable pedantic locking... no
checking checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/tmp/pear/temp/pthreads/configure' failed

So it seems that I need ZTS to be enabled in the vagrant environment. Is there any way to specify it in the config.yaml file? This is what I currently have:

---
vagrantfile-local:
    vm:
        box: debian-wheezy72-x64-vbox43
        box_url: 'http://box.puphpet.com/debian-wheezy72-x64-vbox43.box'
        hostname: null
        network:
            private_network: 192.168.56.101
            forwarded_port:
                RPfV8nB1v0E7:
                    host: '7885'
                    guest: '22'
        provider:
            virtualbox:
                modifyvm:
                    natdnshostresolver1: on
                    memory: '512'
                setextradata:
                    VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root: 1
        provision:
            puppet:
                manifests_path: puphpet/puppet
                manifest_file: manifest.pp
                options:
                    - '--verbose'
                    - '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
                    - '--parser future'
        synced_folder:
            Nko2ivpBaaBH:
                source: ./
                target: /var/www/php-mud-client
                nfs: 'false'
        usable_port_range: 2200..2250
    ssh:
        host: null
        port: null
        private_key_path: null
        username: vagrant
        guest_port: null
        keep_alive: true
        forward_agent: false
        forward_x11: false
        shell: 'bash -l'
    vagrant:
        host: detect
server:
    packages:
        - vim
    dot_files:
        -
            bash_aliases: null
    _prevent_empty: ''
mailcatcher:
    install: 0
    settings:
        smtp_ip: 0.0.0.0
        smtp_port: 1025
        http_ip: 0.0.0.0
        http_port: '1080'
        mailcatcher_path: /usr/local/bin
        log_path: /var/log/mailcatcher/mailcatcher.log
apache:
    install: 1
    settings:
        user: www-data
        group: www-data
        default_vhost: true
        manage_user: false
        manage_group: false
        sendfile: 0
    modules:
        - php
        - rewrite
    vhosts: {  }
    mod_pagespeed: 0
    mod_spdy: 0
php:
    install: '1'
    version: '55'
    composer: '1'
    modules:
        php:
            - cli
            - intl
            - mcrypt
        pear: {  }
        pecl:
            - pecl_http
            - pthreads
    ini:
        display_errors: On
        error_reporting: '-1'
        session.save_path: /var/lib/php/session
    timezone: Europe/Madrid
mysql:
    install: 0
    root_password: '123'
    phpmyadmin: 0
    adminer: 0
    databases: {  }
postgresql:
    install: 0
    settings:
        root_password: '123'
        user_group: postgres
        encoding: UTF8
        version: '9.3'
    databases: {  }
    adminer: 0
mariadb:
    install: 0
    root_password: '123'
    phpmyadmin: 0
    adminer: 0
    databases: {  }
mongodb:
    install: 0
    settings:
        auth: 1
        port: '27017'
    databases: {  }
redis:
    install: 0
    settings:
        conf_port: '6379'
beanstalkd:
    install: 0
    settings:
        listenaddress: 0.0.0.0
        listenport: '13000'
        maxjobsize: '65535'
        maxconnections: '1024'
        binlogdir: /var/lib/beanstalkd/binlog
        binlogfsync: null
        binlogsize: '10485760'
    beanstalk_console: 0
    binlogdir: /var/lib/beanstalkd/binlog
rabbitmq:
    install: 0
    settings:
        port: '5672'
  • 写回答

1条回答 默认 最新

  • dongzhi5587 2014-05-15 11:37
    关注

    I've finally created a vagrant file with a shell script that compiles PHP 5.5 with the following options enabled:

    • enable-debug
    • enable-maintainer-zts
    • enable-pthreads

    The vagrant files can be found on Github: https://github.com/carlescliment/configs/tree/master/vagrant/php-with-zts

    Since I don't need a very complex environment it seems to be enough.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算