Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ansible/roles/php
  • ericzillmann/php
2 results
Show changes
Commits on Source (115)
Showing
with 674 additions and 399 deletions
The MIT License (MIT)
Copyright (c) 2015, 2016 Jürgen Haas, PARAGON Executive Services GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
php_called_from_apache: false
php_needs_oci8: false
php_conf_dir: 'conf.d'
---
php_version: 7.0
php_version_main: 7
php_fpm: yes
php_fpm_socket: no
php_install_redis: yes
php_hold_version: no
php_repositories: []
php_packages:
- php-apc
- php-imagick
- php-pear
- php-soap
- php-uploadprogress
- php5
- php5-cgi
- php5-cli
- php5-curl
- php5-dev
- php5-fpm
- php5-gd
- php5-imap
- php5-mcrypt
- php5-mysql
- php5-xdebug
- php5-xmlrpc
php_base_dir: php5
php_conf_dir: conf.d
php_allow_call_time_pass_reference: 'on'
php_max_execution_time: '30'
php_max_input_vars: '1000'
php_memory_limit: '32M'
php_browscap: no
php_date_timezone: Europe/Berlin
php_display_errors: 'Off'
php_display_startup_errors: 'Off'
php_error_reporting: 'E_ALL & ~E_NOTICE'
php_filter_default: 'unsafe_raw'
php_error_reporting: E_ALL & ~E_NOTICE
php_expose_php: 'Off'
php_filter_default: unsafe_raw
php_html_errors: 'Off'
php_log_errors: 'On'
php_magic_quotes_gpc: 'On'
php_post_max_size: '32M'
php_upload_max_filesize: '2M'
php_date_timezone: 'Europe/Berlin'
php_max_execution_time: 30
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
php_post_max_size: 32M
php_register_globals: 'Off'
php_register_long_arrays: 'On'
php_session_cookie_lifetime: '0'
php_session_gc_divisor: '1000'
php_session_gc_maxlifetime: '1440'
php_session_cache_expire: '180'
php_expose_php: 'Off'
php_browscap: false
php_sendmail_path: ''
php_sendmail_path: /usr/sbin/sendmail -t -i
php_session_cache_expire: 180
php_session_cookie_lifetime: 0
php_session_gc_divisor: 1000
php_session_gc_maxlifetime: 1440
php_short_open_tag: 'Off'
php_upload_max_filesize: 2M
php_zend_assertions: -1
# PHP FPM
php_fpm_max_children: 10
php_fpm_start_servers: 4
php_fpm_min_spare_servers: 2
php_fpm_max_spare_servers: 6
php_fpm_max_requests: 2000
# apc.ini
apc_rfc1867: '1'
apc_shm_size: '256M'
apc_shm_segments: '1'
apc_num_files_hint: '0'
apc_rfc1867: 1
apc_shm_size: 32M
apc_shm_segments: 1
apc_num_files_hint: 0
apc_ttl: 7200
apc_user_ttl: 7200
apc_gc_ttl: 3600
# opcache.ini
opcache_memory_consumption: 128
opcache_max_accelerated_files: 7963
opcache_revalidate_freq: 30
opcache_interned_strings_buffer: 16
# php 5.3
php53:
libraries:
- file: libgd.so.2.0.0
link: libgd.so.2
- file: liblcms.so.1.0.19
link: liblcms.so.1
- file: libMagickCore.so.4.0.1
link: libMagickCore.so.4
- file: libMagickWand.so.4.0.1
link: libMagickWand.so.4
- file: libt1.so.5.1.2
link: libt1.so.5
liblinks:
- src: /lib/x86_64-linux-gnu/libpng12.so.0
link: libpng12.so.0
modules:
- 'apc'
- 'curl'
#- 'gd' (needs libgd.so.2)
#- 'imagick'
- 'imap'
#- 'json'
- 'mcrypt'
#- 'memcached'
- 'mysql'
- 'mysqli'
- 'pdo_mysql'
#- 'readline'
- 'redis'
- 'xmlrpc'
extdir: '/usr/local/lib/php/extensions/no-debug-non-zts-20090626'
- apc
- curl
- gd
- imagick
- imap
# - json
- mcrypt
# - memcached
- mysql
- mysqli
- pdo_mysql
# - readline
- redis
- xmlrpc
extdir: /usr/local/lib/php/extensions/no-debug-non-zts-20090626
libdir: /usr/lib/x86_64-linux-gnu
This diff is collapsed.
No preview for this file type
File added
File added
File added
File added
File added
File added
---
# file: roles/php/handlers/php.yml
# file: roles/php/handlers/main.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"
- name: Restart PHP-FPM
service:
name: '{{ phpFpmService }}'
state: restarted
- name: Initial Logrotate
shell: logrotate -f /etc/logrotate.d/php{{ phpLogRotatePrefix }}-fpm
---
dependencies:
- { role: apache }
- { role: imagemagick }
......@@ -5,9 +5,36 @@
---
# file: roles/php/tasks/main.yml
- include: php.yml
when: role_php_completed is not defined
- name: PHP Role
set_fact:
role_php_started: yes
tags:
- always
- name: 'PHP | Remember that this role had been run'
set_fact: role_php_completed=true
when: role_php_completed is not defined
- block:
- name: Include variables
include_tasks: variables.yml
tags:
- always
- name: Import php
import_tasks: php.yml
- name: Link PhpEnMod for PHP 5.3
file:
dest: /usr/local/bin/php{{ item }}
src: /usr/sbin/php5{{ item }}
state: link
with_items:
- enmod
- dismod
when: php_version|default("5.5") == "5.3"
- name: PHP | Remember that this role had been run
set_fact:
role_php_completed: yes
tags:
- always
when: (not excluded_roles or "php" not in excluded_roles) and role_php_completed is not defined
---
# 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
---
# file: roles/php/tasks/msodbc.yml
- name: Apt Key
apt_key:
keyring: /etc/apt/trusted.gpg.d/microsoft.gpg
url: 'https://packages.microsoft.com/keys/microsoft.asc'
state: present
- name: Apt Repository
apt_repository:
repo: 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod {{ ansible_distribution_release }} main'
state: present
mode: 0644
- name: Accept licenses
debconf:
name: "{{ item }}-installer"
question: "{{ item }}/accept_eula"
value: "true"
vtype: "select"
with_items:
- mssql-tools
- name: Install Packages
apt:
pkg: '{{ packages }}'
state: present
update_cache: yes
vars:
packages:
- mssql-tools
- unixodbc-dev
notify:
- Restart Apache
- name: PHP | Install PECL packages
shell: pecl install --soft {{ item }}
with_items:
- sqlsrv
- pdo_sqlsrv
when: false
- name: Configuration files
copy:
content: extension={{ item }}.so
dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini
owner: root
group: root
mode: 0644
with_items:
- sqlsrv
- pdo_sqlsrv
notify:
- Restart Apache
when: false
- name: Enable extensions
shell: phpenmod {{ item }}
with_items:
- sqlsrv
- pdo_sqlsrv
notify:
- Restart Apache
when: false
---
# file: roles/php/tasks/oci-5.3.yml
#
# @see OCI8 Install: https://help.ubuntu.com/community/PHPOracle
# Better:
# @see PDO_OCI Install: https://drupal.org/comment/5572626#comment-5572626
- name: PHP | Check OCI Requirement
stat:
path: /usr/lib/php5/20090626/pdo_oci.so
register: oci_file
- block:
- name: PHP | OCI | Enable OCI 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:
- oci8
- pdo_oci
- name: PHP | OCI | Remove possible components in /tmp
file:
path: /tmp/{{ item }}
state: absent
with_items:
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so
- oracle_x64_11_2_0_3_0_pdo_oci_so
- name: PHP | OCI | Make available Oracle InstantClient
command: scp -r {{ repository }}{{ item }} /tmp/
become: no
with_items:
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so
- oracle_x64_11_2_0_3_0_pdo_oci_so
- name: PHP | OCI | Remove /usr/local/lib/instantclient_11_2
file:
path: /usr/local/lib/instantclient_11_2
state: absent
- name: PHP | OCI | Move Oracle InstantClient to /usr/local/lib
command: mv /tmp/instantclient_11_2 /usr/local/lib/
- name: PHP | OCI | Move oci8 to /usr/lib/php5
command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so /usr/lib/php5/20090626/oci8.so
- name: PHP | OCI | Move pdo_oci to /usr/lib/php5
command: mv /tmp/oracle_x64_11_2_0_3_0_pdo_oci_so /usr/lib/php5/20090626/pdo_oci.so
- name: PHP | OCI | Change ownership for Oracle InstantClient
file:
path: '{{ item }}'
owner: root
group: root
recurse: yes
follow: no
with_items:
- /usr/local/lib/instantclient_11_2
- name: Ensure log directories
file:
path: /usr/local/lib/instantclient_11_2/log/diag/clients
owner: www-data
group: root
state: directory
mode: 0775
follow: no
- name: Set permissions in log directories
file:
path: /usr/local/lib/instantclient_11_2/log
owner: www-data
group: root
mode: 0775
recurse: yes
follow: no
- name: PHP | OCI | Make available libclntsh.so
file:
src: /usr/local/lib/instantclient_11_2/libclntsh.so.11.1
dest: /usr/local/lib/instantclient_11_2/libclntsh.so
state: link
when: not oci_file.stat.exists
---
# file: roles/php/tasks/oci-5.5.yml
- debug: msg="OCI8 for PHP 5.5 not implemented yet"
---
# file: roles/php/tasks/oci-5.6.yml
- name: Check OCI Requirement
stat:
path: /usr/lib/php/20131226/oci8.so
register: oci_file
- block:
- name: Enable OCI 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:
- oci8
- name: Remove possible components in /tmp
file:
path: /tmp/{{ item }}
state: absent
with_items:
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_5_6
- name: Make available Oracle InstantClient
command: scp -r {{ repository }}{{ item }} /tmp/
become: no
with_items:
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_5_6
- name: Remove /usr/local/lib/instantclient_11_2
file:
path: /usr/local/lib/instantclient_11_2
state: absent
- name: Move Oracle InstantClient to /usr/local/lib
command: mv /tmp/instantclient_11_2 /usr/local/lib/
- name: Move oci8 to /usr/lib/php
command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so_php_4_5 /usr/lib/php/20131226/oci8.so
- name: Change ownership for Oracle InstantClient
file:
path: '{{ item }}'
owner: root
group: root
recurse: yes
follow: no
with_items:
- /usr/local/lib/instantclient_11_2
- name: Ensure log directories
file:
path: /usr/local/lib/instantclient_11_2/log/diag/clients
owner: www-data
group: root
state: directory
mode: 0775
follow: no
- name: Set permissions in log directories
file:
path: /usr/local/lib/instantclient_11_2/log
owner: www-data
group: root
mode: 0775
recurse: yes
follow: no
- name: Make available libclntsh.so
file:
src: /usr/local/lib/instantclient_11_2/libclntsh.so.11.1
dest: /usr/local/lib/instantclient_11_2/libclntsh.so
state: link
when: not oci_file.stat.exists
---
# file: roles/php/tasks/oci-7.0.yml
- name: Check OCI Requirement
stat:
path: /usr/lib/php/20151012/oci8.so
register: oci_file
- block:
- name: Enable OCI 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:
- oci8
- name: Remove possible components in /tmp
file:
path: /tmp/{{ item }}
state: absent
with_items:
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_7
- name: Make available Oracle InstantClient
command: scp -r {{ repository }}{{ item }} /tmp/
become: no
with_items:
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_7
- name: Remove /usr/local/lib/instantclient_11_2
file:
path: /usr/local/lib/instantclient_11_2
state: absent
- name: Move Oracle InstantClient to /usr/local/lib
command: mv /tmp/instantclient_11_2 /usr/local/lib/
- name: Move oci8 to /usr/lib/php
command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so_php_7 /usr/lib/php/20151012/oci8.so
- name: Change ownership for Oracle InstantClient
file:
path: '{{ item }}'
owner: root
group: root
recurse: yes
follow: no
with_items:
- /usr/local/lib/instantclient_11_2
- name: Ensure log directories
file:
path: /usr/local/lib/instantclient_11_2/log/diag/clients
owner: www-data
group: root
state: directory
mode: 0775
follow: no
- name: Set permissions in log directories
file:
path: /usr/local/lib/instantclient_11_2/log
owner: www-data
group: root
mode: 0775
recurse: yes
follow: no
- name: Make available libclntsh.so
file:
src: /usr/local/lib/instantclient_11_2/libclntsh.so.11.1
dest: /usr/local/lib/instantclient_11_2/libclntsh.so
state: link
when: not oci_file.stat.exists
---
# file: roles/php/tasks/oci-7.1.yml
- debug: msg="OCI8 for PHP 7.1 not implemented yet"