in reply to ENV(SERVER_URL) is NULL

What does one part of your problem (your program) have to do with the other part (your environment)?

Please reduce your program to a self-contained program that we can run, no longer than 20 lines. Then look in the webserver error log for the errors your webserver records when running that program.