diff --git a/defaults/main.yml b/defaults/main.yml index fab78fd05984059dcf7621bc3a7353c5aaca3943..3974485154f4564f72e988076fef007388b5d9cd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,4 +1,3 @@ -php_called_from_apache: false php_install_redis: true php_repositories: [] php_packages: @@ -19,9 +18,11 @@ php_packages: - php5-xmlrpc - imagemagick +php_base_dir: 'php5' +php_conf_dir: 'conf.d' + php_allow_call_time_pass_reference: 'on' php_browscap: false -php_conf_dir: 'conf.d' php_date_timezone: 'Europe/Berlin' php_display_errors: 'Off' php_display_startup_errors: 'Off' diff --git a/handlers/main.yml b/handlers/main.yml deleted file mode 100644 index 37c5633fd172a2ca29ca26902872b1e04ccf51a3..0000000000000000000000000000000000000000 --- a/handlers/main.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# file: roles/php/handlers/php.yml - -- name: "PHP | Restart Apache" - debug: msg="Need to restart Apache server" - when: php_called_from_apache - changed_when: php_called_from_apache - notify: - - "Apache | Restart Apache" diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..b974baf26019a91dfb115def20f2685e838c6979 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: + - { role: apache } diff --git a/tasks/oci.yml b/tasks/oci.yml index 235043db8c001f86e8b24f63e03ff0581b2cc30b..9ea95ef7b381b9c9e3553f4f9b3f93caa6e191c4 100644 --- a/tasks/oci.yml +++ b/tasks/oci.yml @@ -8,7 +8,7 @@ - name: "PHP | OCI | Enable OCI for PHP" copy: content='extension={{ item }}.so' - dest=/etc/php5/{{ php_conf_dir }}/{{ item }}.ini + dest=/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini owner=root group=root mode=0644 diff --git a/tasks/php.yml b/tasks/php.yml index 7ff7eab5e810f6b1e237c41e9c47a6eca9bde6e1..6d93576efa1c70d278115c18f41fb6ff82b980fd 100644 --- a/tasks/php.yml +++ b/tasks/php.yml @@ -13,18 +13,25 @@ state=installed with_items: '{{ php_packages }}' notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" + +- name: "PHP | Ensure Apache config directory" + file: + dest=/etc/{{ php_base_dir }}/apache2 + state=directory + owner=root + group=root + mode=0755 - name: "PHP | Configuration file, php.ini" template: src=etc-php5-apache2-php.ini - dest=/etc/php5/apache2/php.ini + dest=/etc/{{ php_base_dir }}/apache2/php.ini owner=root group=root mode=0644 - when: not php_called_from_apache notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - include: php53.yml when: php_version|default('5.5') == '5.3' @@ -36,33 +43,32 @@ owner=root group=root mode=0644 - when: not php_called_from_apache notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - name: "PHP | Cache configuration file, apc.ini" template: src=etc-php5-conf-d-apc.ini - dest=/etc/php5/{{ php_conf_dir }}/apc.ini + dest=/etc/{{ php_base_dir }}/{{ php_conf_dir }}/apc.ini owner=root group=root mode=0644 notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - name: "PHP | Cache configuration file, opcache.ini" template: src=etc-php5-conf-d-opcache.ini - dest=/etc/php5/{{ php_conf_dir }}/opcache.ini + dest=/etc/{{ php_base_dir }}/{{ php_conf_dir }}/opcache.ini owner=root group=root mode=0644 notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - name: "PHP | Create extra directory for browscap" file: - dest=/etc/php5/apache2/extra + dest=/etc/{{ php_base_dir }}/apache2/extra state=directory owner=root group=root @@ -71,12 +77,12 @@ - name: "PHP | browscap.ini" copy: src=browscap.ini - dest=/etc/php5/apache2/extra/browscap.ini + dest=/etc/{{ php_base_dir }}/apache2/extra/browscap.ini owner=root group=root when: php_browscap notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - name: "PHP | Enable PHP modules" shell: php5enmod {{ item }} @@ -84,9 +90,9 @@ - mcrypt - imap - imagick - when: php_conf_dir == 'mods-available' + when: php_version|default('5.5') != '7' and php_conf_dir == 'mods-available' notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - name: "PHP | Create htdocs directory for apc status" file: @@ -109,7 +115,7 @@ ignore_errors: yes changed_when: oci_available.stdout != '/usr/lib/php5/20090626/pdo_oci.so' notify: - - "PHP | Restart Apache" + - "Apache | Restart Apache" - include: oci.yml when: repository is defined and php_needs_oci8 and oci_available.stdout != '/usr/lib/php5/20090626/pdo_oci.so' diff --git a/tasks/php53.yml b/tasks/php53.yml index 6492b428ce08231390008d29d02073be7e6c7514..7e0caf4ed8f2c699e46f0fc50da968782c2ec5c4 100644 --- a/tasks/php53.yml +++ b/tasks/php53.yml @@ -8,7 +8,7 @@ dest='{{ item }}' state='directory' with_items: - - '/etc/php5/fpm/pool.d/' + - '/etc/{{ php_base_dir }}/fpm/pool.d/' - name: "Check PHP 5.3 Requirement" shell: php --version @@ -134,7 +134,7 @@ - name: "Create PHP53 INI Files" template: src='etc-php5-apache2-php.ini' - dest='/etc/php5/{{ item }}/php.ini' + dest='/etc/{{ php_base_dir }}/{{ item }}/php.ini' owner='root' group='root' mode='644' diff --git a/templates/etc-init-d-php53-fpm b/templates/etc-init-d-php53-fpm index 773d3908deb9fe0042a29fbcee347927620694f9..5a7b54c8e5b077b876999fb34541d176a4488949 100644 --- a/templates/etc-init-d-php53-fpm +++ b/templates/etc-init-d-php53-fpm @@ -14,8 +14,8 @@ prefix=/usr/local exec_prefix=${prefix} php_fpm_BIN=${exec_prefix}/sbin/php-fpm -php_fpm_CONF=/etc/php5/fpm/php-fpm.conf -php_fpm_INI=/etc/php5/fpm/php.ini +php_fpm_CONF=/etc/{{ php_base_dir }}/fpm/php-fpm.conf +php_fpm_INI=/etc/{{ php_base_dir }}/fpm/php.ini php_fpm_PID=/var/run/php5-fpm.pid php_opts="-c $php_fpm_INI --fpm-config $php_fpm_CONF --pid $php_fpm_PID" diff --git a/templates/etc-php5-apache2-php.ini b/templates/etc-php5-apache2-php.ini index c23cca5f7db49cffceb7da21e0dcc98afdbfe958..16bb5fda270d68df7a9335052eaa6f79f27d7948 100644 --- a/templates/etc-php5-apache2-php.ini +++ b/templates/etc-php5-apache2-php.ini @@ -1349,7 +1349,7 @@ bcmath.scale = 0 ; http://php.net/browscap ;browscap = extra/browscap.ini {% if php_browscap %} -browscap = /etc/php5/apache2/extra/browscap.ini +browscap = /etc/{{ php_base_dir }}/apache2/extra/browscap.ini {% endif %} [Session]