Включить pthreads для PHP с помощью Vagrant и puphpet

Я пытался включить расширение pthreads в Vagrant. Я сгенерировал Vagrantfile через puphpet и выбрал pthreads в разделе PECL. Когда я делаю vagrant up, он говорит, что все в порядке, но когда я запускаю php -m на виртуальной машине, расширение отсутствует, а классы недоступны.

Если я делаю vagrant ssh и пытаюсь установить pthreads вручную, я получаю следующую ошибку:

$ 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

Похоже, мне нужно, чтобы ZTS был включен в бродячей среде. Есть ли способ указать это в файле config.yaml? Вот что у меня сейчас есть:

---
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 ответ

Наконец-то я создал бродячий файл со сценарием оболочки, который компилирует PHP 5.5 со следующими включенными параметрами:

  • включить-отладки
  • включить-Сопровождающий ZTS
  • включить-потоки

Файлы бродяги можно найти на Github: https://github.com/carlescliment/configs/tree/master/vagrant/php-with-zts

Поскольку мне не нужна очень сложная среда, этого, кажется, достаточно.

Другие вопросы по тегам