Replace source db vars with env db vars and misc deletions in PHP