[SOLVED]Array $_SERVER empty

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
samuel.vannesteBUSGvXT
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 43
Joined: Wed Sep 19, 2012 6:32 pm
Location: Versailles, France

[SOLVED]Array $_SERVER empty

Post by samuel.vannesteBUSGvXT » Fri Oct 11, 2013 11:20 pm

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
Last edited by samuel.vannesteBUSGvXT on Sat Oct 12, 2013 1:55 pm, edited 1 time in total.

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Array $_SERVER empty

Post by icouto » Sat Oct 12, 2013 12:12 am

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.

samuel.vannesteBUSGvXT
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 43
Joined: Wed Sep 19, 2012 6:32 pm
Location: Versailles, France

Re: Array $_SERVER empty

Post by samuel.vannesteBUSGvXT » Sat Oct 12, 2013 9:48 am

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.)

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 928
Joined: Fri Aug 15, 2008 7:15 am

Re: Array $_SERVER empty

Post by bangkok » Sat Oct 12, 2013 12:28 pm

Try :

Code: Select all

<?lc

put $_SERVER["REMOTE_ADDR"]

?>
Double quote... not single.

samuel.vannesteBUSGvXT
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 43
Joined: Wed Sep 19, 2012 6:32 pm
Location: Versailles, France

Re: Array $_SERVER empty

Post by samuel.vannesteBUSGvXT » Sat Oct 12, 2013 1:55 pm

It worked :D
Thanks a lot bangkok. I stupidly respected the sample provided in the Dictionary without thinking. :oops:

Post Reply

Return to “CGIs and the Server”