2023-10-11 09:28:59 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
bundle agent install_php
|
|
|
|
{
|
2023-10-24 14:27:32 +00:00
|
|
|
classes:
|
2023-10-29 00:09:46 +00:00
|
|
|
"use_ext_repos";
|
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
vars:
|
2023-10-25 07:35:18 +00:00
|
|
|
"version" string => "$(php.version)";
|
|
|
|
centos::
|
|
|
|
"version" string => "";
|
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
|
2023-10-24 14:27:32 +00:00
|
|
|
freebsd::
|
2023-10-11 09:28:59 +00:00
|
|
|
|
|
|
|
freebsd::
|
|
|
|
"pkgs" slist => {
|
2023-10-24 21:17:23 +00:00
|
|
|
"php$(php.bsdvs)-session",
|
|
|
|
"php$(php.bsdvs)-zip",
|
2023-11-04 21:08:37 +00:00
|
|
|
"php$(php.bsdvs)-zlib",
|
|
|
|
"php$(php.bsdvs)-phar",
|
2023-10-24 21:17:23 +00:00
|
|
|
"php$(php.bsdvs)-pgsql",
|
|
|
|
"php$(php.bsdvs)-mysqli",
|
|
|
|
"php$(php.bsdvs)-filter",
|
|
|
|
"php$(php.bsdvs)-mbstring",
|
|
|
|
"php$(php.bsdvs)-dom",
|
|
|
|
"php$(php.bsdvs)-xml",
|
2023-11-04 21:08:37 +00:00
|
|
|
"php$(php.bsdvs)-simplexml",
|
2023-10-24 21:17:23 +00:00
|
|
|
"php$(php.bsdvs)-ctype",
|
|
|
|
"php$(php.bsdvs)-intl",
|
2023-11-01 14:59:02 +00:00
|
|
|
"php$(php.bsdvs)-curl",
|
|
|
|
"php$(php.bsdvs)-fileinfo",
|
|
|
|
"php$(php.bsdvs)-exif",
|
|
|
|
"php$(php.bsdvs)-iconv",
|
|
|
|
"php$(php.bsdvs)-ldap",
|
|
|
|
"php$(php.bsdvs)-gd",
|
|
|
|
"php$(php.bsdvs)-pecl-imagick",
|
|
|
|
"php$(php.bsdvs)-pdo",
|
|
|
|
"php$(php.bsdvs)-pdo_sqlite",
|
|
|
|
"php$(php.bsdvs)-sqlite3",
|
|
|
|
"php$(php.bsdvs)-pdo_pgsql",
|
|
|
|
"php$(php.bsdvs)-pdo_mysql",
|
2023-11-04 21:08:37 +00:00
|
|
|
"php$(php.bsdvs)-tokenizer",
|
|
|
|
"php$(php.bsdvs)-gettext"
|
|
|
|
# "php$(php.bsdvs)-pear-channel-doctrine"
|
2023-11-01 14:59:02 +00:00
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
};
|
2023-10-21 22:09:18 +00:00
|
|
|
# "php$(bsdvs)-json",
|
2023-10-11 09:28:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
debian::
|
|
|
|
"pkgs" slist => {
|
2023-10-24 14:27:32 +00:00
|
|
|
"php$(version)-cli",
|
2023-10-11 09:28:59 +00:00
|
|
|
"php$(version)-common",
|
|
|
|
"php$(version)-zip",
|
|
|
|
"php$(version)-pgsql",
|
|
|
|
"php$(version)-mysql",
|
|
|
|
"php$(version)-xml",
|
2023-10-24 14:27:32 +00:00
|
|
|
"php$(version)-gd",
|
|
|
|
"php$(version)-mbstring",
|
|
|
|
"php$(version)-intl",
|
|
|
|
"php$(version)-curl",
|
|
|
|
"php$(version)-imagick",
|
|
|
|
"php$(version)-ldap",
|
2023-11-10 13:23:14 +00:00
|
|
|
# "php$(version)-json"
|
2023-10-14 13:16:00 +00:00
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
};
|
|
|
|
ubuntu::
|
|
|
|
"pkgs" slist => {
|
|
|
|
"php$(version)-common",
|
|
|
|
"php$(version)-zip",
|
|
|
|
"php$(version)-pgsql",
|
|
|
|
"php$(version)-mysql",
|
|
|
|
"php$(version)-xml",
|
|
|
|
"php$(version)-mbstring",
|
|
|
|
"php-geshi",
|
|
|
|
"php-json",
|
|
|
|
"php-gd",
|
|
|
|
};
|
|
|
|
|
2023-10-25 07:35:18 +00:00
|
|
|
centos::
|
2023-10-29 00:09:46 +00:00
|
|
|
"xversion" string => "";
|
2023-10-25 07:35:18 +00:00
|
|
|
"pkgs" slist => {
|
2023-10-29 00:09:46 +00:00
|
|
|
"php$(xversion)-cli",
|
|
|
|
"php$(xversion)-common",
|
|
|
|
"php$(xversion)-pgsql",
|
|
|
|
"php$(xversion)-mysqlnd",
|
|
|
|
"php$(xversion)-xml",
|
|
|
|
"php$(xversion)-gd",
|
|
|
|
"php$(xversion)-mbstring",
|
|
|
|
"php$(xversion)-intl",
|
|
|
|
"php$(xversion)-ldap",
|
2023-11-03 11:53:49 +00:00
|
|
|
"php$(xversion)-pecl-imagick-im6",
|
2023-11-03 07:53:54 +00:00
|
|
|
"php-pecl-json-post",
|
|
|
|
"php-pecl-apcu",
|
|
|
|
"php-pecl-zip",
|
2023-11-14 18:47:58 +00:00
|
|
|
"php$(xversion)-process"
|
2023-10-25 07:35:18 +00:00
|
|
|
};
|
2023-10-29 00:09:46 +00:00
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
|
2023-10-24 14:27:32 +00:00
|
|
|
commands:
|
|
|
|
# (debian|ubuntu)&php_install_repo::
|
|
|
|
# "/bin/sh"
|
|
|
|
# args => "$(sys.workdir)/inputs/$(def.wmde_libdir)/scripts/install-php-sury.sh",
|
|
|
|
# handle => "php_repo_ready";
|
|
|
|
# (debian|ubuntu)&(!php_install_repo)::
|
|
|
|
# "/usr/bin/true"
|
|
|
|
# inform => "false",
|
|
|
|
# handle => "php_repo_ready";
|
|
|
|
|
|
|
|
# !(debian|ubuntu)::
|
|
|
|
|
|
|
|
|
|
|
|
methods:
|
2023-10-29 00:09:46 +00:00
|
|
|
debian&use_ext_repos::
|
|
|
|
"any" usebundle => install_apt_repo("php","$(php.apt_repo_url)","$(php.apt_repo_key)","$(php.apt_repo_key_name)"),
|
|
|
|
handle => "php_repo_ready";
|
|
|
|
|
|
|
|
centos::
|
|
|
|
"any" usebundle => php_install_centos_repos,
|
|
|
|
handle => "php_repo_ready";
|
2023-10-24 14:27:32 +00:00
|
|
|
|
2023-10-29 00:09:46 +00:00
|
|
|
|
|
|
|
any::
|
2023-10-24 14:27:32 +00:00
|
|
|
"any" usebundle => wmde_install_packages(@(pkgs),"php"),
|
|
|
|
depends_on => {"php_repo_ready"};
|
2023-10-29 00:09:46 +00:00
|
|
|
|
|
|
|
commands:
|
2023-11-01 14:59:02 +00:00
|
|
|
freebsd::
|
|
|
|
"/usr/bin/true"
|
|
|
|
inform => "false",
|
|
|
|
handle => "php_repo_ready";
|
2023-10-29 00:09:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bundle agent php_install_centos_repos
|
|
|
|
{
|
|
|
|
classes:
|
|
|
|
centos::
|
2023-11-03 07:53:54 +00:00
|
|
|
"switch_repo" expression => not(returnszero("cat /etc/dnf/modules.d/php.module 2>/dev/null | grep -q '^stream.*=.*remi-$(php.version)'","useshell"));
|
2023-10-29 00:09:46 +00:00
|
|
|
"install_remi" expression => not(returnszero("rpm -q remi-release > /dev/null","useshell"));
|
|
|
|
"install_epel" expression => not(returnszero("rpm -q epel-release > /dev/null","useshell"));
|
|
|
|
|
|
|
|
commands:
|
|
|
|
centos&install_epel::
|
|
|
|
"/usr/bin/yum"
|
2023-10-29 19:49:14 +00:00
|
|
|
args => "install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(sys.os_version_major).noarch.rpm",
|
2023-10-29 00:09:46 +00:00
|
|
|
handle => "php_epel_repo_installed";
|
|
|
|
|
|
|
|
centos&(!install_epel)::
|
|
|
|
"/usr/bin/true"
|
|
|
|
inform => "false",
|
|
|
|
handle => "php_epel_repo_installed";
|
|
|
|
|
|
|
|
centos&install_remi::
|
|
|
|
"/usr/bin/yum"
|
|
|
|
args => "install -y https://rpms.remirepo.net/enterprise/remi-release-$(sys.os_version_major).rpm",
|
|
|
|
depends_on => {"php_epel_repo_installed"},
|
|
|
|
handle => "php_remi_repo_installed";
|
|
|
|
|
|
|
|
centos&(!install_remi)::
|
|
|
|
"/usr/bin/true"
|
|
|
|
inform => "false",
|
|
|
|
handle => "php_remi_repo_installed";
|
|
|
|
|
|
|
|
|
|
|
|
centos&switch_repo::
|
|
|
|
"dnf" args => "module switch-to php:remi-$(php.version) -y",
|
|
|
|
contain => wmde_cmd_useshell,
|
|
|
|
depends_on => {"php_remi_repo_installed"};
|
|
|
|
|
|
|
|
|
|
|
|
methods:
|
2023-10-11 09:28:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bundle agent php(settings)
|
|
|
|
{
|
|
|
|
vars:
|
2023-10-27 23:10:32 +00:00
|
|
|
"ini_files" slist => { };
|
2023-10-24 14:27:32 +00:00
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
debian::
|
2023-10-24 16:34:53 +00:00
|
|
|
"version" string => "8.0";
|
2023-10-11 09:28:59 +00:00
|
|
|
"ini_files" slist => {
|
2023-10-29 00:09:46 +00:00
|
|
|
# "/etc/php/$(php.version)/apache2/php.ini",
|
|
|
|
# "/etc/php/$(php.version)/fpm/php.ini"
|
2023-10-11 09:28:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
"cli_exe" string => "/usr/bin/php";
|
|
|
|
|
2023-10-24 14:27:32 +00:00
|
|
|
"fpm_pkgs" slist => { "php$(version)-fpm" };
|
|
|
|
"fpm_service_name" string => "php$(version)-fpm";
|
2023-10-24 16:34:53 +00:00
|
|
|
"fpm_socket" string => "/run/php/php$(version)-fpm.sock";
|
2023-11-16 20:25:31 +00:00
|
|
|
"fpm_socket_type" string => "unix:";
|
2023-10-24 14:27:32 +00:00
|
|
|
|
|
|
|
"apt_repo_url" string => "https://packages.sury.org/php/";
|
|
|
|
"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg";
|
|
|
|
"apt_repo_key_name" string=> "deb.sury.org-php.gpg";
|
2023-10-24 16:34:53 +00:00
|
|
|
|
|
|
|
"apache_m" string => "php";
|
|
|
|
"apache_f" string => "libphp$(php.version)";
|
|
|
|
|
2023-10-24 14:27:32 +00:00
|
|
|
ubuntu::
|
|
|
|
"apt_repo_url" string => "https://ppa.launchpadcontent.net/ondrej/php/ubuntu/";
|
|
|
|
"apt_repo_key" string => "";
|
|
|
|
"apt_repo_key_name" string=> "";
|
|
|
|
|
|
|
|
ubuntu_22::
|
|
|
|
"version" string => "8.2";
|
|
|
|
|
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
freebsd::
|
|
|
|
"ini_files" slist => {
|
2023-11-01 14:59:02 +00:00
|
|
|
# "/etc/php/$(install_php.version)/apache2/php.ini",
|
|
|
|
# "/etc/php/$(install_php.version)/fpm/php.ini"
|
2023-10-11 09:28:59 +00:00
|
|
|
};
|
|
|
|
"cli_exe" string => "/usr/local/bin/php";
|
2023-10-21 22:09:18 +00:00
|
|
|
"version" string => "8.2";
|
|
|
|
"bsdvs" string => "82";
|
|
|
|
"apache_m" string => "php";
|
|
|
|
"apache_f" string => "libphp";
|
2023-11-01 14:59:02 +00:00
|
|
|
"fpm_pkgs" slist => {};
|
|
|
|
"fpm_service_name" string => "php-fpm";
|
|
|
|
"fpm_socket" string => "127.0.0.1:9000";
|
2023-11-16 20:25:31 +00:00
|
|
|
"fpm_socket_type" string => "fcgi://";
|
2023-10-11 09:28:59 +00:00
|
|
|
|
2023-10-25 07:35:18 +00:00
|
|
|
centos::
|
2023-10-27 23:10:32 +00:00
|
|
|
"cli_exe" string => "/usr/bin/php";
|
2023-11-14 18:47:58 +00:00
|
|
|
"version" string => "8.1";
|
2023-10-29 00:09:46 +00:00
|
|
|
"fpm_pkgs" slist => { "php-fpm" };
|
2023-10-25 07:35:18 +00:00
|
|
|
"fpm_service_name" string => "php$(version)-fpm";
|
|
|
|
"fpm_socket" string => "/run/php-fpm/www.sock";
|
2023-11-16 20:25:31 +00:00
|
|
|
"fpm_socket_type" string => "unix:";
|
2023-10-25 07:35:18 +00:00
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
|
|
|
|
files:
|
|
|
|
"$(ini_files)"
|
|
|
|
create => "true",
|
|
|
|
edit_template => "$(sys.workdir)/inputs/$(wmde_libdir)/templates/php.ini.mustache",
|
|
|
|
template_method => "mustache",
|
|
|
|
template_data => @(settings),
|
2023-10-24 15:13:26 +00:00
|
|
|
classes => if_repaired(php_repaired);
|
2023-10-11 09:28:59 +00:00
|
|
|
|
|
|
|
|
2023-10-29 00:09:46 +00:00
|
|
|
#methods:
|
|
|
|
# "any" usebundle => install_php;
|
2023-10-11 09:28:59 +00:00
|
|
|
reports:
|
2023-11-01 14:59:02 +00:00
|
|
|
# "PHP VERSION: $(ini_files) V:$(install_php.version)";
|
2023-10-11 09:28:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-24 14:27:32 +00:00
|
|
|
bundle agent install_php_fpm
|
|
|
|
{
|
2023-11-01 14:59:02 +00:00
|
|
|
vars:
|
|
|
|
"service_deps" slist => {
|
|
|
|
"php_fpm_pkgs_installed",
|
|
|
|
"php_pkgs_installed"
|
|
|
|
};
|
|
|
|
freebsd::
|
|
|
|
"service_deps" slist => {
|
|
|
|
"php_pkgs_installed"
|
|
|
|
};
|
2023-11-16 20:25:31 +00:00
|
|
|
"service_name" string => "$(php.fpm_service_name)";
|
|
|
|
"service_cfg_name" string => "php_fpm";
|
2023-11-01 14:59:02 +00:00
|
|
|
|
2023-10-24 14:27:32 +00:00
|
|
|
methods:
|
|
|
|
"any" usebundle => install_php;
|
|
|
|
"any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm");
|
|
|
|
|
2023-11-16 20:25:31 +00:00
|
|
|
"any" usebundle => wmde_enable_service("$(this.bundle)");
|
2023-10-24 14:27:32 +00:00
|
|
|
|
2023-10-24 15:13:26 +00:00
|
|
|
"any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"),
|
2023-11-01 14:59:02 +00:00
|
|
|
depends_on => @(service_deps);
|
|
|
|
reports:
|
|
|
|
# "php ????";
|
2023-10-24 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
2023-10-11 09:28:59 +00:00
|
|
|
|
|
|
|
bundle agent php_composer(cfg)
|
|
|
|
{
|
|
|
|
vars:
|
|
|
|
"installer" string => "$(sys.workdir)/data/php/composer-setup.php";
|
|
|
|
"exe" string => "/usr/local/bin/composer";
|
|
|
|
classes:
|
|
|
|
"php_composer_install" expression => not(fileexists("$(exe)"));
|
|
|
|
|
|
|
|
vars:
|
|
|
|
|
|
|
|
|
|
|
|
files:
|
|
|
|
"$(sys.workdir)/data/php/."
|
|
|
|
create => "true",
|
|
|
|
handle => "php_dir_created";
|
|
|
|
commands:
|
|
|
|
php_composer_install::
|
|
|
|
"$(wget.exe) -q -O $(installer) https://getcomposer.org/installer"
|
|
|
|
handle => "php_composer_installer_downloaded",
|
|
|
|
depends_on => {"php_dir_created"};
|
|
|
|
|
2023-11-03 11:53:49 +00:00
|
|
|
"export HOME=/root && $(php.cli_exe) $(installer) --install-dir=/usr/local/bin --filename=composer"
|
2023-10-11 09:28:59 +00:00
|
|
|
handle => "php_composer_installed",
|
2023-11-03 11:53:49 +00:00
|
|
|
contain => wmde_cmd_useshell,
|
2023-10-11 09:28:59 +00:00
|
|
|
depends_on => {"php_composer_installer_downloaded"};
|
|
|
|
|
|
|
|
|
|
|
|
methods:
|
|
|
|
"any" usebundle => install_php;
|
|
|
|
"any" usebundle => install_wget;
|
|
|
|
}
|