Switching / updating PHP versions DirectAdmin

# Switching / updating PHP versions

Make a backup

    tar czvf ~/domain-conf-backup.tgz /usr/local/directadmin/data/users/**/domains/*.conf

Force PHP to be version 1 if no default is set

    grep -rF -L php1_select /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step1 '$ a php1_select=1'

Change new version to temporary position

    grep -rF -l 'php1_select=3' /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step2 's/^php1_select=3/php1_select=31/'

Change old version to old position

    grep -rF -l 'php1_select=1' /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step3 's/^php1_select=1/php1_select=3/'

Change new version to new position

    grep -rF -l 'php1_select=31' /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step4 's/^php1_select=31/php1_select=1/'

Adjust PHP versions inside custombuild

    DO THIS MANUALLY

Rewrite config files

    cd /usr/local/directadmin/custombuild && ./build rewrite_confs