Switch active php version using netbeans-php-tools which provide "usephp" command.
See plugin at NetBeans plugins or MavenCentral
Thanks to https://github.com/anchialas/CoolEditorActions & https://www.javacodegeeks.com/2015/02/write-netbeans-plugin.html
More plugins https://github.com/topics/netbeans-plugin