Installs the php-cli package. | Installs the php-cli package. | ||||
``php.composer`` | ``php.composer`` | ||||
----------- | |||||
---------------- | |||||
Installs [composer](https://getcomposer.org) and keeps it updated. | Installs [composer](https://getcomposer.org) and keeps it updated. | ||||
Installs the php-cli package. | Installs the php-cli package. | ||||
``php.ng.composer`` | |||||
------------------- | |||||
Installs [composer](https://getcomposer.org) and keeps it updated. | |||||
``php.ng.curl`` | ``php.ng.curl`` | ||||
--------------- | --------------- | ||||
update-composer: | update-composer: | ||||
cmd.run: | cmd.run: | ||||
- name: "{{ install_file }} selfupdate" | - name: "{{ install_file }} selfupdate" | ||||
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") \> $(date "+%s") | |||||
{% if grains['os_family'] == 'FreeBSD' %} | |||||
- unless: test $(date -v+60d -j -f "%Y-%m-%d %H:%M:%S" "$({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") | |||||
{% else %} | |||||
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") | |||||
{% endif %} | |||||
- cwd: {{ php.local_bin }} | - cwd: {{ php.local_bin }} | ||||
- env: | - env: | ||||
- HOME: {{ salt_user_home }} | - HOME: {{ salt_user_home }} |
'xml_pkg': ['php5-xmlreader','php5-xmlwriter','php5-xmlrpc'], | 'xml_pkg': ['php5-xmlreader','php5-xmlwriter','php5-xmlrpc'], | ||||
'zip_pkg': 'php5-zip', | 'zip_pkg': 'php5-zip', | ||||
}, | }, | ||||
'FreeBSD': { | |||||
'local_bin': '/usr/local/bin', | |||||
'composer_bin': 'composer', | |||||
'temp_dir': '/tmp', | |||||
}, | |||||
}, merge=salt['pillar.get']('php:lookup')) %} | }, merge=salt['pillar.get']('php:lookup')) %} | ||||
{%- endif %} | {%- endif %} |
{% from "php/ng/map.jinja" import php with context %} | |||||
{% from "php/ng/map.jinja" import phpng_version with context %} | |||||
{% set major = phpng_version.split('.')|first %} | |||||
LoadModule php{{ major }}_module /usr/local/libexec/{{ php.lookup.apache2.name }}/libphp{{ major }}.so | |||||
DirectoryIndex index.html index.php | |||||
<FilesMatch "\.php$"> | |||||
SetHandler application/x-httpd-php | |||||
</FilesMatch> | |||||
<FilesMatch "\.phps$"> | |||||
SetHandler application/x-httpd-php-source | |||||
</FilesMatch> |
# Manages the libapache2-mod-php5 main ini file | |||||
# Manages the main Apache2 ini file | |||||
{% from "php/ng/map.jinja" import php with context %} | {% from "php/ng/map.jinja" import php with context %} | ||||
{% from "php/ng/ini.jinja" import php_ini %} | {% from "php/ng/ini.jinja" import php_ini %} | ||||
# Installs libapache2-mod-php5 package and manages the associated php.ini on os Debian | |||||
{% if grains['os_family'] == "Debian" %} | |||||
include: | include: | ||||
{% if grains['os_family'] in ["Debian", "FreeBSD"] %} | |||||
- php.ng.apache2.install | - php.ng.apache2.install | ||||
{% endif %} #END: os = Debian|FreeBSD | |||||
{% if grains['os_family'] == "Debian" %} | |||||
- php.ng.apache2.ini | - php.ng.apache2.ini | ||||
extend: | extend: | ||||
file: | file: | ||||
- require: | - require: | ||||
- sls: php.ng.apache2.install | - sls: php.ng.apache2.install | ||||
{% endif %} #END: os = debian | {% endif %} #END: os = debian |
{% from "php/ng/map.jinja" import php with context %} | |||||
{% set state = 'apache2' %} | {% set state = 'apache2' %} | ||||
{% include "php/ng/installed.jinja" %} | {% include "php/ng/installed.jinja" %} | ||||
{% if grains['os_family'] == "FreeBSD" %} | |||||
{{ php.lookup.apache2.module_config }}: | |||||
file.managed: | |||||
- source: salt://php/ng/apache2/files/mod_php.conf.jinja | |||||
- template: jinja | |||||
{% if salt['pillar.get']('php:ng:use_apache_formula', True) %} | |||||
- makedirs: true | |||||
- require_in: | |||||
- sls: apache | |||||
- watch_in: | |||||
- module: apache-restart | |||||
{% endif %} #END: use apache formula | |||||
{% endif %} #END: os = debian |
include: | include: | ||||
- php.ng | - php.ng | ||||
{% if grains['os_family'] == 'FreeBSD' %} | |||||
- php.ng.filter | |||||
- php.ng.hash | |||||
- php.ng.json | |||||
- php.ng.mbstring | |||||
- php.ng.openssl | |||||
- php.ng.phar | |||||
{% endif %} | |||||
get-composer: | get-composer: | ||||
file.managed: | file.managed: | ||||
update-composer: | update-composer: | ||||
cmd.run: | cmd.run: | ||||
- name: "{{ install_file }} selfupdate" | - name: "{{ install_file }} selfupdate" | ||||
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") \> $(date "+%s") | |||||
{% if grains['os_family'] == 'FreeBSD' %} | |||||
- unless: test $(date -v+60d -j -f "%Y-%m-%d %H:%M:%S" "$({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") | |||||
{% else %} | |||||
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") | |||||
{% endif %} | |||||
- cwd: {{ php.lookup.pkgs.local_bin }} | - cwd: {{ php.lookup.pkgs.local_bin }} | ||||
- env: | - env: | ||||
- HOME: {{ salt_user_home }} | - HOME: {{ salt_user_home }} |
{% set state = 'filter' %} | |||||
{% include "php/ng/installed.jinja" %} |
{% set state = 'hash' %} | |||||
{% include "php/ng/installed.jinja" %} |
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# vim: ft=jinja | # vim: ft=jinja | ||||
{%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %} | |||||
{%- set freebsd_phpng_version = phpng_version.replace('.', '') %} | |||||
{%- if salt['grains.get']('os') == "Ubuntu" %} | {%- if salt['grains.get']('os') == "Ubuntu" %} | ||||
{%- set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %} | {%- set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %} | ||||
{%- if use_external_repo %} | {%- if use_external_repo %} | ||||
{%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %} | |||||
{%- if salt['grains.get']('osrelease')|string >= '16.04' %} | {%- if salt['grains.get']('osrelease')|string >= '16.04' %} | ||||
{%- set php = salt['pillar.get']('php:ng', { | {%- set php = salt['pillar.get']('php:ng', { | ||||
'lookup': salt['grains.filter_by']({ | 'lookup': salt['grains.filter_by']({ | ||||
'cgi': 'php-cgi', | 'cgi': 'php-cgi', | ||||
'cli': 'php-cli', | 'cli': 'php-cli', | ||||
'console-table': 'php-console-table', | 'console-table': 'php-console-table', | ||||
'composer_bin': 'composer', | |||||
'curl': 'php-curl', | 'curl': 'php-curl', | ||||
'dev': 'php7.1-dev', | 'dev': 'php7.1-dev', | ||||
'fpm': 'php-fpm', | 'fpm': 'php-fpm', | ||||
'intl': 'php-intl', | 'intl': 'php-intl', | ||||
'json': 'php-json', | 'json': 'php-json', | ||||
'ldap': 'php-ldap', | 'ldap': 'php-ldap', | ||||
'local_bin': '/usr/local/bin', | |||||
'mbstring': 'php-mbstring', | 'mbstring': 'php-mbstring', | ||||
'mcrypt': 'php-mcrypt', | 'mcrypt': 'php-mcrypt', | ||||
'memcache': 'php-memcache', | 'memcache': 'php-memcache', | ||||
'suhosin': 'php', | 'suhosin': 'php', | ||||
'sybase': 'php-sybase', | 'sybase': 'php-sybase', | ||||
'tcpdf': 'php-tcpdf', | 'tcpdf': 'php-tcpdf', | ||||
'temp_dir': '/tmp', | |||||
'tidy': 'php7.1-tidy', | 'tidy': 'php7.1-tidy', | ||||
'xcache': 'php', | 'xcache': 'php', | ||||
'xdebug': 'php-xdebug', | 'xdebug': 'php-xdebug', | ||||
'cgi': 'php-cgi', | 'cgi': 'php-cgi', | ||||
'cli': 'php-cli', | 'cli': 'php-cli', | ||||
'console-table': 'php-console-table', | 'console-table': 'php-console-table', | ||||
'composer_bin': 'composer', | |||||
'curl': 'php-curl', | 'curl': 'php-curl', | ||||
'dev': 'php7.0-dev', | 'dev': 'php7.0-dev', | ||||
'fpm': 'php-fpm', | 'fpm': 'php-fpm', | ||||
'intl': 'php-intl', | 'intl': 'php-intl', | ||||
'json': 'php-json', | 'json': 'php-json', | ||||
'ldap': 'php-ldap', | 'ldap': 'php-ldap', | ||||
'local_bin': '/usr/local/bin', | |||||
'mbstring': 'php-mbstring', | 'mbstring': 'php-mbstring', | ||||
'mcrypt': 'php-mcrypt', | 'mcrypt': 'php-mcrypt', | ||||
'memcache': 'php-memcache', | 'memcache': 'php-memcache', | ||||
'suhosin': 'php', | 'suhosin': 'php', | ||||
'sybase': 'php-sybase', | 'sybase': 'php-sybase', | ||||
'tcpdf': 'php-tcpdf', | 'tcpdf': 'php-tcpdf', | ||||
'temp_dir': '/tmp', | |||||
'tidy': 'php7.0-tidy', | 'tidy': 'php7.0-tidy', | ||||
'xcache': 'php', | 'xcache': 'php', | ||||
'xdebug': 'php-xdebug', | 'xdebug': 'php-xdebug', | ||||
{%- endif %} | {%- endif %} | ||||
{%- endif %} | {%- endif %} | ||||
{%- elif salt['grains.get']('os') == "Debian" %} | {%- elif salt['grains.get']('os') == "Debian" %} | ||||
{%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %} | |||||
{%- if phpng_version|string == '5' %} | {%- if phpng_version|string == '5' %} | ||||
{%- set confdir = '/etc/php5' %} | {%- set confdir = '/etc/php5' %} | ||||
{%- else %} | {%- else %} | ||||
'ini': '/etc/php/conf.d/xcache.ini', | 'ini': '/etc/php/conf.d/xcache.ini', | ||||
}, | }, | ||||
}, | }, | ||||
'FreeBSD': { | |||||
'apache2': { | |||||
'ini': '/usr/local/etc/php.ini', | |||||
'module_config': '/usr/local/etc/apache24/modules.d/050_mod_php.conf', | |||||
'name': 'apache24', | |||||
}, | |||||
'cli': { | |||||
'ini': '/usr/local/etc/php.ini' | |||||
}, | |||||
'pkgs': { | |||||
'apache2': 'mod_php' + freebsd_phpng_version, | |||||
'composer_bin': 'composer', | |||||
'filter': 'php' + freebsd_phpng_version + '-filter', | |||||
'hash': 'php' + freebsd_phpng_version + '-hash', | |||||
'json': 'php' + freebsd_phpng_version + '-json', | |||||
'local_bin': '/usr/local/bin', | |||||
'mbstring': 'php' + freebsd_phpng_version + '-mbstring', | |||||
'openssl': 'php' + freebsd_phpng_version + '-openssl', | |||||
'php': 'php' + freebsd_phpng_version, | |||||
'phar': 'php' + freebsd_phpng_version + '-phar', | |||||
'temp_dir': '/tmp', | |||||
}, | |||||
}, | |||||
}), | }), | ||||
'fpm': { | 'fpm': { | ||||
'service': { | 'service': { |
{% set state = 'openssl' %} | |||||
{% include "php/ng/installed.jinja" %} |
{% set state = 'phar' %} | |||||
{% include "php/ng/installed.jinja" %} |
- pcntl_wait | - pcntl_wait | ||||
'CLI Server': | 'CLI Server': | ||||
cli_server_color: 'On' | cli_server_color: 'On' | ||||
# When using php.ng.apache2 on FreeBSD: | |||||
# Set this to False if you're not using apache-formula | |||||
use_apache_formula: True |