From b9966c502672ba8e2343fc66d7c3d45493f40db3 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Tue, 26 Nov 2019 10:19:24 +0100 Subject: [PATCH] Install mcrypt for PHP 7.2 --- defaults/main.yml | 1 + tasks/mcrypt-7.2.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ tasks/php.yml | 4 ++++ 3 files changed, 48 insertions(+) create mode 100644 tasks/mcrypt-7.2.yml diff --git a/defaults/main.yml b/defaults/main.yml index def1a47..a42304f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -48,6 +48,7 @@ php_max_file_uploads: 20 php_max_input_time: 60 php_max_input_vars: 1000 php_memory_limit: 32M +php_needs_mcrypt: no php_needs_msodbc: no php_needs_oci8: no php_output_buffering: 4096 diff --git a/tasks/mcrypt-7.2.yml b/tasks/mcrypt-7.2.yml new file mode 100644 index 0000000..67edd74 --- /dev/null +++ b/tasks/mcrypt-7.2.yml @@ -0,0 +1,43 @@ +--- +# file: roles/php/tasks/mcrypt-7.2.yml + +- name: Check MCrypt Requirement + stat: + path: /usr/lib/php/20170718/mcrypt.so + register: mcrypt_file + +- block: + + - name: Enable MCrypt for PHP + copy: + content: extension={{ item }}.so + dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini + owner: root + group: root + mode: 0644 + with_items: + - mcrypt + + - name: Install packages + apt: + pkg: '{{ packages }}' + state: present + update_cache: yes + vars: + packages: + - libmcrypt-dev + - libreadline-dev + + - name: Install PECL packages + shell: pecl install --soft --ignore-errors mcrypt-1.0.1 + when: php_version_main|default(7) == 7 + ignore_errors: yes + + - name: Enable extension + shell: phpenmod {{ item }} + with_items: + - mcrypt + notify: + - Restart Apache + + when: not mcrypt_file.stat.exists diff --git a/tasks/php.yml b/tasks/php.yml index 90aef8d..1d48329 100644 --- a/tasks/php.yml +++ b/tasks/php.yml @@ -111,6 +111,10 @@ include_tasks: oci-{{ php_version|default('5.5') }}.yml when: repository is defined and php_needs_oci8 +- name: Include mcrypt + include_tasks: mcrypt-7.2.yml + when: php_version|default('5.5') == '7.2' and php_needs_mcrypt + - name: Import msodbc import_tasks: msodbc.yml when: php_needs_msodbc -- GitLab