
I recently updated a server with DirectAdmin to MariaDB 10.2, which requires a different php module to talk to PHP.
I have around 400 users on this server in their own LVE (lightweight virtulised environments) in CloudLinux, so how to change the drivers to new one, but only in PHP 5.6, PHP 7.0 & PHP 7.1
Well here is the script I wrote, and it works a treat!
#!/bin/bash
for RESELLER in admin $(cat /usr/local/directadmin/data/admin/reseller.list)
do
for USER in ${RESELLER} $(cat /usr/local/directadmin/data/users/${RESELLER}/users.list)
do
if [ ${USER} != "admin" ]
then
for VERSION in 5.6 7.0 7.1
do
echo "User: ${USER}, Version: ${VERSION}"
selectorctl --disable-user-extensions=mysql,mysqli --version=${VERSION} --user=${USER}
selectorctl --enable-user-extensions=mysqlnd,nd_mysqli --version=${VERSION} --user=${USER}
done
fi
done
done
