$_SERVER variables not supported?

134 views
Skip to first unread message

King of the Fools

unread,
Nov 25, 2010, 9:50:12 PM11/25/10
to HipHop for PHP Dev
Hey guys,
Sorry to keep bothering you like this, but I can't find the
documentation I need in the coding for hiphop area.

I'm hoping that someone here has seen this.

My first instinct was to attempt to run my shiny new hiphop program as
a cgi script.
It made sense, because I figured the code was there, and it should be
able to stand alone, if I'm reading it correctly.

So I renamed the file program.cgi, instead of program, and ran it
through the paces on my personal test server.

First thing I encountered was that no headers were naturally returned.
Easy enough, I thought, I can manually write headers if I need to.

But when I wrote in the headers, recompiled, and tested the program, I
quickly learned that standard php $_SERVER variables don't seem to be
available when running code in this context.

I ended up with a header block that looked like this:

Host: HipHop Notice: Undefined index: HTTP_HOST
User-Agent: HipHop Notice: Undefined index: HTTP_USER_AGENT
Accept: HipHop Notice: Undefined index: HTTP_USER_AGENT
Accept-Language: HipHop Notice: Undefined index: HTTP_ACCEPT_LANGUAGE
Accept-Encoding: HipHop Notice: Undefined index: HTTP_ACCEPT_ENCODING
Accept-Charset: HipHop Notice: Undefined index: HTTP_ACCEPT_CHARSET
Keep-Alive: HipHop Notice: Undefined index: HTTP_KEEP_ALIVE
Connection: HipHop Notice: Undefined index: HTTP_CONNECTION
Referer: HipHop Notice: Undefined index: HTTP_REFERER
Cache-Control: HipHop Notice: Undefined index: HTTP_CACHE_CONTROL


Is there a work around?
Or is running hiphop output through the CGI just a bad idea to begin
with?

How do you do it?

King of the Fools

unread,
Nov 25, 2010, 10:15:29 PM11/25/10
to HipHop for PHP Dev
Oddly enough, when the only header variable I set is content type, the
script executes with no issues.
Huh.... I guess you learn something new every day (one would hope).

Server variables are important though.
Anyone know of another way to get them, or a context besides raw cgi
that makes sense?

On Nov 25, 8:50 pm, King of the Fools <idontunderstandgi...@gmail.com>
wrote:

Scott MacVicar

unread,
Nov 25, 2010, 11:26:36 PM11/25/10
to <hiphop-php-dev@googlegroups.com>
It has a HTTP server built in, you can start the program with -m sever -p 8080 and it will start a full web server bound on port 8080.

- Scott

Reply all
Reply to author
Forward
0 new messages