Browse Source

php.ng.apache2: FreeBSD support

tags/v0.34.0
Alexander Weidinger 6 years ago
parent
commit
b89f0b5299
6 changed files with 50 additions and 7 deletions
  1. +14
    -0
      php/ng/apache2/files/mod_php.conf.jinja
  2. +1
    -1
      php/ng/apache2/ini.sls
  3. +3
    -4
      php/ng/apache2/init.sls
  4. +16
    -0
      php/ng/apache2/install.sls
  5. +12
    -2
      php/ng/map.jinja
  6. +4
    -0
      pillar.example

+ 14
- 0
php/ng/apache2/files/mod_php.conf.jinja View File

{% 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>

+ 1
- 1
php/ng/apache2/ini.sls View File

# 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 %}



+ 3
- 4
php/ng/apache2/init.sls View File

# 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

+ 16
- 0
php/ng/apache2/install.sls View File

{% 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

+ 12
- 2
php/ng/map.jinja View File

# -*- 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']({
{%- 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': {
'module_config': '/usr/local/etc/apache24/modules.d/050_mod_php.conf',
'name': 'apache24',
},
'pkgs': {
'apache2': 'mod_php' + freebsd_phpng_version,
},
},
}), }),
'fpm': { 'fpm': {
'service': { 'service': {

+ 4
- 0
pillar.example View File

- 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

Loading…
Cancel
Save