Results 1 to 2 of 2

Thread: PHP gettext not working on shared hosting

  1. #1
    Join Date
    Dec 2016
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP gettext not working on shared hosting

    I've shared hosting by asphostportal. Can anyone tell me how to get PHP gettext working on shared hosting? This is code I tried:

    Code:
    function namesti_jezik($jezik='rs')
    {   
        // Set language to German
        putenv('LC_ALL='.$jezik);
        setlocale(LC_ALL, $jezik);
    
        // Specify location of translation tables
        bindtextdomain($this->CI->config->item('aplikacija_domen'), "./lokal");
    
        // Choose domain
        textdomain($this->CI->config->item('aplikacija_domen'));
    
        $param=array(
            'jezik'=>$jezik
        );
    
        $this->CI->session->set_userdata($param);
    
        // Translation is looking for in ./locale/de_DE/LC_MESSAGES/myPHPApp.mo now
    }
    and

    Code:
    function namesti_jezik($jezik='rs')
    {   
        putenv("LANG=".$jezik); //not needed for my tests, but people say it's useful for windows
    
        setlocale( LC_MESSAGES, $jezik);
        bindtextdomain($this->CI->config->item('aplikacija_domen'), dirname(BASEPATH).'/lokal');
        textdomain($this->CI->config->item('aplikacija_domen'));
    
        $param=array(
            'jezik'=>$jezik
        );
    
        $this->CI->session->set_userdata($param);
    }
    The first one works on development machine. Both of these don't work on shared hosting and I have locales I need enabled. Any help is appreciated. Thanks.

  2. #2
    Join Date
    Mar 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php-gd extenstion

    my code works fine it Depends on your hosting. i have account and asked they install php-gd extension, other than that your code it free of external dependencies? So they installed php-gd and it worked for me...

    I would contact the hosting company and ask them to install php-gd, it should work for you.
    Last edited by jscheuer1; 03-22-2018 at 05:09 PM.

Similar Threads

  1. Replies: 16
    Last Post: 12-18-2013, 12:36 AM
  2. Replies: 2
    Last Post: 07-27-2011, 06:13 AM
  3. Replies: 3
    Last Post: 07-09-2010, 04:15 AM
  4. Personal hosting = Shared hosting
    By zenaire in forum The lounge
    Replies: 1
    Last Post: 01-04-2010, 01:29 PM
  5. Shared Drive Analysis
    By london_83 in forum The lounge
    Replies: 4
    Last Post: 02-10-2006, 04:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •