Permalink
Browse files

Add "cibox-php-pcntl" role which allow to additionaly install PCNTL e…

…xtension
  • Loading branch information...
BR0kEN- committed Mar 16, 2016
1 parent e1fc338 commit 9864379dce1fdf7e54b8b1b45c97ca80e6e3d0db
@@ -0,0 +1,2 @@
---
cibox_php_pcntl: no
@@ -0,0 +1,59 @@
---
- name: Create directory for PHP sources
file:
path: /tmp/phpsource
state: directory
register: php_sources

- name: Get PHP sources
shell: "apt-get source php5"
args:
# Disable warning about usage of "apt" module due to it unable load sources.
warn: no
chdir: "{{ php_sources.path }}"
removes: "{{ php_sources.path }}"

- name: Register path to PCNTL extension sources
# Folder contains archives and only one subfolder, the name of which always differ (depending on PHP version).
shell: "echo $(ls -d */)ext/pcntl"
args:
chdir: "{{ php_sources.path }}"
register: php_pcntl

- name: Register path to pcntl.so
set_fact:
php_pcntl_so_path: "{{ php_sources.path }}/{{ php_pcntl.stdout }}/modules/pcntl.so"

- name: Check that pcntl.so compiled and exists
stat:
path: "{{ php_pcntl_so_path }}"
register: php_pcntl_so

- name: Compile PCNTL extension
shell: "phpize && ./configure && make"
args:
chdir: "{{ php_sources.path }}/{{ php_pcntl.stdout }}"
when: "{{ not php_pcntl_so.stat.exists }}"

- name: Register path to directory with PHP extensions
shell: "php -i | awk -F '=>' '/^extension_dir/ {print $2}'"
register: php_extension_dir

- name: Copy compiled PCNTL extension to PHP extensions directory
# Strange, but "copy" module tells that source file does not exists.
shell: "cp {{ php_pcntl_so_path }} {{ php_extension_dir.stdout }}"
# copy:
# src: "{{ php_pcntl_so_path }}"
# dest: "{{ php_extension_dir.stdout }}"

- name: Allow to use PCNTL extension as Apache module
lineinfile:
dest: "/etc/php5/apache2/conf.d/pcntl.ini"
line: "extension=pcntl.so"
state: present
create: yes

- name: Restart Apache
service:
name: apache2
state: restarted
@@ -0,0 +1,3 @@
---
- include: install.yml
when: "{{ cibox_php_pcntl }}"
@@ -34,8 +34,10 @@
php_apc_shm_size: "96M"
php_apc_stat: "1"
php_apc_enable_cli: "0"
cibox_php_pcntl: no

roles:
- { role: '../core/facade-php' }
- { role: '../core/facade-php-pear' }
- { role: '../core/facade-php-xhprof' }
- { role: '../core/cibox-php-pcntl' }
@@ -8,6 +8,7 @@ dependencies:
- { role: '../core/cibox-drush' }
- { role: '../core/facade-php-pear' }
- { role: '../core/facade-php-xhprof' }
- { role: '../core/cibox-php-pcntl' }
- { role: '../core/facade-mysql' }
- { role: '../core/cibox-jenkins' }
- { role: '../core/cibox-jetty-solr' }
@@ -17,6 +17,7 @@
# PHP configs.
php_apc_enabled_in_ini: true

cibox_php_pcntl: no
# Apache config.
cibox_ssl_folder: /etc/apache/ssl
apache_create_vhosts: true

0 comments on commit 9864379

Please sign in to comment.