Page 1 of 1

[SOLVED]Array $_SERVER empty

Posted: Fri Oct 11, 2013 11:20 pm
by samuel.vannesteBUSGvXT
Hello,

I just installed livecode-server on a new machine (Linux Ubuntu Server 13.04). It works exactly like it did on my old server :D

But I can not get any information from the $_SERVER array (without any error but just blank). Do you please have any idea how to fix this ?

Thanks :D

Re: Array $_SERVER empty

Posted: Sat Oct 12, 2013 12:12 am
by icouto
Are you trying to access it via apache or as a command-line cgi?

Post an example of your code, as it may help us pinpoint the problem.

Re: Array $_SERVER empty

Posted: Sat Oct 12, 2013 9:48 am
by samuel.vannesteBUSGvXT
Hello Icouto,

Thanks for you reply. The server is Apache2 using Webmin. As I installed it long time ago on the old server, I followed the instruction provided in the help and located here and here.

For testing I used a script provided by HyperActive Software.

Code: Select all

#!revolution 
# This script loops over all the environment variables 
# set by the server when it runs a CGI application printing out 
# its name and value. 
on startup 
# loop over all of the global variables, getting name and value 
repeat for each item i in the globals 
put i && "=" && value(i) & return after buffer
end repeat 
# write minimal set of HTTP headers to stdout 
read from stdin until empty 
put it after buffer 
put "Content-Type: text/plain" & cr 
put "Content-Length:" && the length of buffer & cr & cr 
put buffer 
end startup
The result is
Content-Type: text/plain
Content-Length: 12

$_SERVER =
And I even tried the simple

Code: Select all

<?lc
put ""
put "Test"
put $_SERVER['REMOTE_ADDR']
put $_SERVER['SERVER_ADDR']
put $_SERVER['SCRIPT_NAME']
?>
The result is
Test
But all other parts of the server are working as expected (sessions, file open, delete, database connection, etc.)

Re: Array $_SERVER empty

Posted: Sat Oct 12, 2013 12:28 pm
by bangkok
Try :

Code: Select all

<?lc

put $_SERVER["REMOTE_ADDR"]

?>
Double quote... not single.

Re: Array $_SERVER empty

Posted: Sat Oct 12, 2013 1:55 pm
by samuel.vannesteBUSGvXT
It worked :D
Thanks a lot bangkok. I stupidly respected the sample provided in the Dictionary without thinking. :oops: