Accessing global variables in a separate PHP script?
You have to define the variable as global first:
global $server_hostname;
$server_hostname = "localhost";
It turns out the file was included somewhere else in the application so when I was calling require_once
, the file was not being included at all. I changed it to just require
and now it works.