logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Apache 2.4.1, mod_fcgid 2.3.7 and PHP localeconv()
Author
rockjock



Joined: 25 Mar 2011
Posts: 8

PostPosted: Mon 05 Mar '12 19:42    Post subject: Apache 2.4.1, mod_fcgid 2.3.7 and PHP localeconv() Reply with quote

localeconv() returns the correct result when running PHP as an Apache module:

Code:
array(18) {
  ["decimal_point"]=>
  string(1) "."
  ["thousands_sep"]=>
  string(1) ","
  ["int_curr_symbol"]=>
  string(3) "USD"
  ["currency_symbol"]=>
  string(1) "$"
  ["mon_decimal_point"]=>
  string(1) "."
  ["mon_thousands_sep"]=>
  string(1) ","
  ["positive_sign"]=>
  string(0) ""
  ["negative_sign"]=>
  string(1) "-"
  ["int_frac_digits"]=>
  int(2)
  ["frac_digits"]=>
  int(2)
  ["p_cs_precedes"]=>
  int(1)
  ["p_sep_by_space"]=>
  int(0)
  ["n_cs_precedes"]=>
  int(1)
  ["n_sep_by_space"]=>
  int(0)
  ["p_sign_posn"]=>
  int(3)
  ["n_sign_posn"]=>
  int(0)
  ["grouping"]=>
  array(1) {
    [0]=>
    int(3)
  }
  ["mon_grouping"]=>
  array(1) {
    [0]=>
    int(3)
  }
}


However, when run using mod_fcgid, localeconv() returns:

Code:
array(18) {
  ["decimal_point"]=>
  string(1) "."
  ["thousands_sep"]=>
  string(0) ""
  ["int_curr_symbol"]=>
  string(0) ""
  ["currency_symbol"]=>
  string(0) ""
  ["mon_decimal_point"]=>
  string(0) ""
  ["mon_thousands_sep"]=>
  string(0) ""
  ["positive_sign"]=>
  string(0) ""
  ["negative_sign"]=>
  string(0) ""
  ["int_frac_digits"]=>
  int(127)
  ["frac_digits"]=>
  int(127)
  ["p_cs_precedes"]=>
  int(127)
  ["p_sep_by_space"]=>
  int(127)
  ["n_cs_precedes"]=>
  int(127)
  ["n_sep_by_space"]=>
  int(127)
  ["p_sign_posn"]=>
  int(127)
  ["n_sign_posn"]=>
  int(127)
  ["grouping"]=>
  array(0) {
  }
  ["mon_grouping"]=>
  array(0) {
  }
}
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 05 Mar '12 20:10    Post subject: Reply with quote

Since PHP is not connected directly to apache it can't grab its local env variables.

What is it that you need from that array that you can't get anywhere else?
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 677

PostPosted: Mon 05 Mar '12 21:09    Post subject: Reply with quote

rockjok replied in a new post:

I have an i18n/l10n-aware application that requires the contents of the entire array. I don't think Apache's SetEnv will solve the problem either, considering the dynamic nature by which my app uses setlocale() at different times during execution.
Back to top
angosso.net



Joined: 28 Jan 2011
Posts: 2
Location: Creteil

PostPosted: Wed 07 Mar '12 17:10    Post subject: Local? Reply with quote

What utility for local.
Bug the script in php directely
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Wed 07 Mar '12 18:12    Post subject: Reply with quote

Since you already know the content of that array and I think it won't change that much, why not fill a regular array with that values?
Back to top
rockjock



Joined: 25 Mar 2011
Posts: 8

PostPosted: Sun 11 Mar '12 0:26    Post subject: Reply with quote

Hard coding is not an option because it's not a scalable solution.
Back to top


Reply to topic   Topic: Apache 2.4.1, mod_fcgid 2.3.7 and PHP localeconv() View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner