#!/bin/bash if (t_GetPkgRel basesystem | grep -q el9) then t_Log "This is a C9 system. Php module not present. Skipping." t_CheckExitStatus 0 exit $PASS fi t_Log "Running $0 - PHP/MariaDB interaction" t_SkipReleaseLessThan 8 'no modularity' t_EnableModuleStream php:7.2 t_InstallPackageMinimal php-cli php-mysqlnd mariadb-server t_Log "starting mariadb service" systemctl --quiet start mariadb t_CheckExitStatus $? t_Log "create a test database" mysql << EOF DROP DATABASE IF EXISTS phptests; CREATE DATABASE phptests; USE phptests; CREATE TABLE tests (name VARCHAR(20)); GRANT ALL ON phptests.* TO 'centos'@'localhost' IDENTIFIED BY 'qa'; FLUSH PRIVILEGES; EOF t_CheckExitStatus $? t_Log "write to test database via PHP" php << EOF &> /dev/null EOF t_CheckExitStatus $? t_Log "read from test database via PHP" php << EOF | grep -q '1' EOF t_CheckExitStatus $? t_Log "stopping mariadb service" systemctl --quiet stop mariadb t_CheckExitStatus $? t_Log "deleting database files" find /var/lib/mysql -mindepth 1 -delete t_CheckExitStatus $? t_RemovePackage php-cli php-mysqlnd mariadb-server t_ResetModule php httpd nginx mariadb