Since I couldn't call PS 7.4 executable directly to execute a script, I implemented a convoluted work-around by calling PS5 script that would call PS7.4 to execute the script I want. To get the output of the script, I redirect it to a temp file and then read it in php.
I will use this setup temporarily until I can figure out why I can't call PS 7.4 executable directly from php.
php code
shell_exec('powershell.exe -File C:\inetpub\ps5-calling7.ps1');
$output = "C:\\inetpub\\env_output.tmp";
ps5-calling7.ps1
Start-Process pwsh.exe -ArgumentList "C:\inetpub\env_output.ps1" -wait -RedirectStandardOutput "env_output.tmp";