Skip to content
Snippets Groups Projects
Commit 9ce8e65b authored by Chris Croome's avatar Chris Croome
Browse files

fixes for when php isn't installed

parent 4b7b67ca
No related branches found
No related tags found
No related merge requests found
Pipeline #10805 passed
......@@ -32,7 +32,7 @@
- "libapache2-mod-php{{ apache_php_version }}"
state: absent
update_cache: false
when: '"apache_phpfpm_mod" in apache_mods_disabled'
when: ( apache_php ) and ( "apache_phpfpm_mod" in apache_mods_disabled )
- name: Disable modules
apache2_module:
......@@ -83,7 +83,7 @@
- "libapache2-mod-php{{ apache_php_version }}"
state: present
update_cache: false
when: '"apache_phpfpm_mod" in apache_mods_enabled'
when: ( apache_php ) and ( "apache_phpfpm_mod" in apache_mods_enabled )
- name: Apache modules enabled
apache2_module:
......
......@@ -180,11 +180,15 @@
when: apache_version is version('2.4.41', '>=')
- name: Check if phpquery is installed
shell: which phpquery || echo absent
shell: which phpquery || echo ABSENT
check_mode: false
register: apache_phpquery_path
changed_when: '"phpquery" not in apache_phpquery_path.stdout'
- name: Set the apache_php variable to true or false
set_fact:
apache_php: "{% if apache_phpquery_path.stdout == 'ABSENT' %}false{% else %}true{% endif %}"
- name: Check PHP version
block:
......@@ -210,7 +214,7 @@
- "apache_phpfpm_conf: {{ apache_phpfpm_conf }}"
verbosity: 2
when: ( apache_phpquery_path is defined ) and ( apache_phpquery_path.stdout == "/usr/sbin/phpquery" )
when: ( apache_php is defined ) and ( apache_php )
- name: Check loaded modules
block:
......
......@@ -21,7 +21,7 @@
</Location>
</IfModule>
{% endif %}
{% if "proxy_fcgi" in apache_mods_enabled %}
{% if apache_php and if "proxy_fcgi" in apache_mods_enabled %}
<Location /status>
SetHandler "proxy:unix:/run/php/php{{ apache_php_version }}-fpm.sock|fcgi://localhost/"
Require host localhost 127.0.0.1 ::1
......@@ -35,7 +35,7 @@
AllowOverride AuthConfig Indexes FileInfo Limit
Require host localhost 127.0.0.1 ::1
{% if apache_mods_enabled is defined %}
{% if apache_phpfpm_mod is defined and apache_phpfpm_mod in apache_mods_enabled %}
{% if apache_php and if apache_phpfpm_mod is defined and apache_phpfpm_mod in apache_mods_enabled %}
<IfModule php7_module>
php_admin_value doc_root /var/www/localhost
php_admin_value open_basedir /var/www/localhost/:/tmp/:/usr/share/php/
......@@ -44,7 +44,7 @@
</FilesMatch>
</IfModule>
{% endif %}
{% if "proxy_fcgi" in apache_mods_enabled %}
{% if apache_php and if "proxy_fcgi" in apache_mods_enabled %}
# https://wiki.apache.org/httpd/PHP-FPM#Proxy_via_handler
<IfModule proxy_fcgi_module>
<IfModule setenvif_module>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment