ansible/php.yaml
2021-03-31 22:00:40 -04:00

91 lines
2.0 KiB
YAML

# Copyright 2021, Edward Kujawski
# https://gitea.atl.org/ekujawski/ansible
# Licenced under the GPL-3 of later license.
# https://gitea.atl.org/ekujawski/ansible/src/branch/master/LICENSE
- name: Install PHP
hosts: application_servers
vars:
php_version: 7.4.16
tasks:
- name: RPM dependencies
dnf:
name:
- git
- gcc
- libxml2-devel
- openssl-devel
- sqlite-devel
- libcurl-devel
- libpng-devel
- libwebp-devel
- libjpeg-turbo-devel
- libXpm-devel
- freetype-devel
- oniguruma-devel
- brotli-devel
- pcre-devel
- zlib-devel
- perl-FindBin
- perl-File-Compare
- name: PHP Downloaded
stat:
path: /usr/local/src/php-{{ php_version }}.tar.xz
register: php_downloaded
- name: Download PHP
shell: |
cd /usr/local/src
wget https://www.php.net/distributions/php-{{ php_version }}.tar.xz
when: php_downloaded.stat.exists == False
- name: PHP Configure
shell: |
cd /usr/local/src
cat > php-{{ php_version }}.configure <<EOF
./configure \
--prefix=/usr/local/php-{{ php_version }} \
--enable-fpm \
--with-mysqli \
--with-openssl \
--with-zlib \
--enable-gd \
--with-webp \
--with-jpeg \
--with-xpm \
--with-freetype \
--enable-gd-jis-conv \
--enable-mbstring \
--with-curl
EOF
- name: PHP Code
shell: |
cd /usr/local/src
rm -rf php-{{ php_version }}
tar -xf php-{{ php_version }}.tar.xz
- name: PHP Compile
shell: |
cd /usr/local/src/php-{{ php_version }}
. ../php-{{ php_version }}.configure
make -j`nproc --all`
- name: PHP Install
shell: |
cd /usr/local/src/php-{{ php_version }}
make install
cd /usr/local
rm -rf php
ln -s php-{{ php_version }} php
cd /usr/local/bin
ln -sf ../php/bin/* .
cd /usr/local/sbin
ln -sf ../php/sbin/* .