Diretadmin does not populate superglobals properly!!

pucky

Verified User
Joined
Sep 9, 2006
Messages
794
This is very annoying. From a programming standpoint when trying to write a plugin for DA one cannot use superglobals because when logged in as Admin or User superglobals these values are not available so one has to spend time coding workarounds to get the value of variables available from Apache.

For instance, when logged into the control using the ip address of the server (http://ipaddress:2222) the return value for SERVER_NAME => is an ip address :( I could understand that if there has been no hostname defined but there is and hostname when typed from the command line retrieves: SERVERS HOST NAME. Assuming that the user logs into the control panel using the servers ip address, this value is wrong because SERVER-NAME should be equal to SERVERS HOSTNAME not the servers ip address.

I need to retrieve the hostname of the server, ie SERVER_NAME = host.name.com not the ip address. I shouldnt have to log out and log into the admin control panel using the servers hostname as one cannot guaratee that every admin will login under the hostname of the server everytime.

How can this be fixed or better yet, how can we retrieve the valud of SERVER_NAME as defined in /etc/hosts???

Really, superglobals should be defined based on Apache. Thats the truth to the matter!!! :rolleyes:
 
Last edited:
Hello,

We do pass most of everyting that apache passes to php via the environment, but the fact remains this this is not an apache module, it's just plain old php binary, hence they're different.

For your hostname, try
PHP:
$hostname = system("/bin/hostname");
John
 
Back
Top