mirror of
https://github.com/geerlingguy/ansible-role-php.git
synced 2024-11-28 12:45:16 +01:00
Add php-fpm support, remove Apache dependency (works with Nginx).
This commit is contained in:
parent
3a6d641399
commit
7908233ae6
13
README.md
13
README.md
@ -6,7 +6,7 @@ Installs PHP on RedHat/CentOS and Debian/Ubuntu servers.
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
Must be running a separate web server, such as Nginx or Apache.
|
||||
|
||||
## Role Variables
|
||||
|
||||
@ -33,13 +33,21 @@ Explicitly set PHP's date timezone system-wide.
|
||||
|
||||
A list of the PHP packages to install (OS-specific by default). You'll likely want to install common packages like `php`, `php-cli`, `php-devel` and `php-pdo`, and you can add in whatever other packages you'd like (for example, `php-gd` for image manipulation, or `php-ldap` if you need to connect to an LDAP server for authentication).
|
||||
|
||||
php_webserver_daemon: "httpd"
|
||||
|
||||
The default values for the HTTP server deamon are `httpd` (used by Apache) for RedHat/CentOS, or `apache2` (also used by Apache) for Debian/Ubuntu. If you are running another webserver (for example, `nginx`), change this value to the name of the daemon under which the webserver runs.
|
||||
|
||||
php_enable_php_fpm: false
|
||||
|
||||
If you add `php-fpm` to the `php_packages` list, and would like to run PHP-fpm, as you would with Nginx or as an alternative to `mod_php` in Apache, you can set this variable to `true`, and the `php-fpm` daemon will be enabled and started. You will need to configure PHP-fpm on your own, by editing the config file in `/etc/php-fpm.d/www.conf` (for RedHat servers) or replacing it with your own template via Ansible.
|
||||
|
||||
php_enablerepo: ""
|
||||
|
||||
(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest geerlingguy.repo-epel or geerlingguy.repo-remi), those repositories can be listed under this variable (e.g. `remi,epel`). This can be handy, as an example, if you want to install the latest version of PHP 5.4, which is in the Remi repository.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- geerlingguy.apache
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
@ -70,7 +78,6 @@ A list of the PHP packages to install (OS-specific by default). You'll likely wa
|
||||
|
||||
- Make role more flexible, allowing APC to be excluded from `php_packages` list.
|
||||
- Use `lineinfile` rather than templates to make configuration changes.
|
||||
- Remove apache dependency (better way of using handler? Way to get around Debian/apt's apache2 + php bindings?).
|
||||
|
||||
## License
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- { role: geerlingguy.apache }
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
author: geerlingguy
|
||||
|
@ -8,7 +8,7 @@
|
||||
state=installed
|
||||
enablerepo={{ php_enablerepo }}
|
||||
with_items: php_packages
|
||||
notify: restart apache
|
||||
notify: restart webserver
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Ensure PHP packages are installed (Debian).
|
||||
@ -16,7 +16,7 @@
|
||||
name={{ item }}
|
||||
state=installed
|
||||
with_items: php_packages
|
||||
notify: restart apache
|
||||
notify: restart webserver
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Place PHP configuration files in place.
|
||||
@ -27,4 +27,8 @@
|
||||
with_items:
|
||||
- { src: php.ini.j2, dest: "{{ php_conf_path }}/php.ini" }
|
||||
- { src: apc.ini.j2, dest: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}" }
|
||||
notify: restart apache
|
||||
notify: restart webserver
|
||||
|
||||
- name: Ensure php-fpm is started and enabled at boot (if configured).
|
||||
service: name=php-fpm state=started enabled=yes
|
||||
when: php_enable_php_fpm
|
||||
|
@ -13,3 +13,4 @@ php_packages:
|
||||
- php5-gd
|
||||
- php5-ldap
|
||||
- php-apc
|
||||
php_webserver_daemon: "apache2"
|
||||
|
@ -16,4 +16,5 @@ php_packages:
|
||||
- php-pear
|
||||
- php-pecl-apc
|
||||
- php-xml
|
||||
- php-xmlrpc
|
||||
- php-xmlrpc
|
||||
php_webserver_daemon: "httpd"
|
||||
|
@ -8,3 +8,6 @@ php_apc_cache_by_default: "1"
|
||||
php_apc_shm_size: "96M"
|
||||
php_date_timezone: "America/Chicago"
|
||||
php_packages: []
|
||||
php_webserver_daemon: "httpd"
|
||||
|
||||
php_enable_php_fpm: false
|
||||
|
Loading…
Reference in New Issue
Block a user