使用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个回答



我终于创建了一个带有shell脚本的vagrant文​​件,该脚本在启用了以下选项的情况下编译PHP 5.5:</ p>

展开原文

原文

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.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐