# Variables in FreeBSD

**URL:** <https://www.ruby-forum.com/t/variables-in-freebsd/166508>\
**Category:** NGINX\
**Created:** [April 26, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/variables-in-freebsd/166508 "2009-04-26T16:46:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalspenguin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dalspenguin](https://www.ruby-forum.com/u/dalspenguin)\
**Post date:** [April 26, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/variables-in-freebsd/166508/1 "2009-04-26T16:46:51Z")

</div>

Hello,

I have created nginx module (compile by gcc) and found that nginx does  
not support VARIABLES on the FreeBSD os.  
I try to use it like  
ngx\_str\_t name = {r-\>variables[1].len, (unsigned char \*)  
r-\>variables[1].data};  
However every time I get errors in the error.log file: signal 11  
It’s works perfect on the Ubuntu os. I’ve read VARIABLES are not  
supported for the nginx 0.7.52. But I need to get the value of variables  
when I call my module from nginx.conf like  
set\_module\_value $returnedValue $incomingValue  
Could anyone help me to get a value from the variable $incomingValue on  
FreeBSD OS?  
Is there any way to get variable value on FreeBSD OS?

Thanks a lot!

Posted at Nginx Forum:

> **[Variables in FreeBSD](https://forum.nginx.org/read.php?2,1447,1447#msg-1447)**
>
> Hello, I have created nginx module (compile by gcc) and found that nginx does not support VARIABLES on the FreeBSD os. I try to use it like ngx\_str\_t name = {r-\>variables\[1\].len, (unsigned char \*) r-\>variables\[1\].data}; However every time I get...

---

<div class="post-metadata">

**Author:** ![dalspenguin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dalspenguin](https://www.ruby-forum.com/u/dalspenguin)\
**Post date:** [April 26, 2009, 11:21pm UTC](https://www.ruby-forum.com/t/variables-in-freebsd/166508/2 "2009-04-26T23:21:38Z")

</div>

Hello!

On Sun, Apr 26, 2009 at 10:34:17AM -0400, dalspenguin wrote:

> Hello,
> 
> I have created nginx module (compile by gcc) and found that nginx does not support VARIABLES on the FreeBSD os.  
> I try to use it like  
> ngx\_str\_t name = {r-\>variables[1].len, (unsigned char \*) r-\>variables[1].data};  
> However every time I get errors in the error.log file: signal 11  
> It’s works perfect on the Ubuntu os. I’ve read VARIABLES are not supported for the nginx 0.7.52. But I need to get the value of variables when I call my module from nginx.conf like  
> set\_module\_value $returnedValue $incomingValue  
> Could anyone help me to get a value from the variable $incomingValue on FreeBSD OS?  
> Is there any way to get variable value on FreeBSD OS?

It’s not really OS related. It’s just the fact that your  
broken code happend to work under Ubuntu for some reason.

You shouldn’t even try to access r-\>variables by hand. Use  
ngx\_http\_variables.[ch] functions instead.

If you know variable name at configuration stage, you should  
probably use ngx\_http\_get\_variable\_index() during parsing config  
and store returned index, and then use  
ngx\_http\_get\_indexed\_variable() during request processing.

Multiple examples of variable usage may be found in various  
official nginx modules, read source for details.

Maxim D.

---

<div class="post-metadata">

**Author:** ![dalspenguin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dalspenguin](https://www.ruby-forum.com/u/dalspenguin)\
**Post date:** [April 28, 2009, 12:53am UTC](https://www.ruby-forum.com/t/variables-in-freebsd/166508/3 "2009-04-28T00:53:25Z")

</div>

Hello,

Thanks a lot.

It’s just working!!!

Yours sincerely,  
Alex

Posted at Nginx Forum:

> **[Re: Variables in FreeBSD](https://forum.nginx.org/read.php?2,1447,1454#msg-1454)**
>
> Hello, I have created nginx module (compile by gcc) and found that nginx does not support VARIABLES on the FreeBSD os. I try to use it like ngx\_str\_t name = {r-\>variables\[1\].len, (unsigned char \*) r-\>variables\[1\].data}; However every time I get...
