Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7402127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:39:58+00:00 2026-05-29T04:39:58+00:00

I built a bilingual application with CodeIgniter and now I need 2 cron jobs

  • 0

I built a bilingual application with CodeIgniter and now I need 2 cron jobs to send emails out to certain users.

The problem I’m having is that I’m unable to run the cron jobs and I believe it is because of the libraries I have to run CodeIgniter in many languages.

I’m attempting to run this command:
php /home/[username]/public_html/projects/[project name]/index.php cron remind

The email I’m getting after it runs is the following:

Content-type: text/html

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The first argument should be either a string or an integer</p>
<p>Filename: core/MY_Lang.php</p>
<p>Line Number: 153</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The first argument should be either a string or an integer</p>
<p>Filename: core/MY_Lang.php</p>
<p>Line Number: 153</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  Cannot modify header information - headers already sent by (output started at /home/vchris/CI-2.0.1/core/Exceptions.php:170)</p>
<p>Filename: core/MY_Lang.php</p>
<p>Line Number: 73</p>

</div>

MY_Lang.php
header is on line 73

if ((!$url_ok) && (!$this->is_special($uri_segment['parts'][0]))) // special URI -> no redirect
        {
            // set default language
            $CFG->set_item('language', $this->languages[$this->default_lang()]);

            $uri = (!empty($this->uri)) ? $this->uri: $this->default_uri;
            $uri = ($uri[0] != '/') ? '/'.$uri : $uri;
            $new_url = $CFG->config['base_url'].$this->default_lang().$uri;

            header("Location: " . $new_url, TRUE, 302);
            exit;
        }

MY_Lang.php
return is on line 153

// default language: first element of $this->languages
 function default_lang()
    {
        $browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
        $browser_lang = substr($browser_lang, 0,2);
        return (array_key_exists($browser_lang, $this->languages)) ? $browser_lang: 'en';
    }

Basically when you browse my site if you don’t have a language set in the url, it will automatically add /en/. Is there a way to bypass that or to set it in the controller? I think MY_Lang is called before the controller. So maybe there’s a way to make it so I don’t have to use index.php to enter CodeIgniter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:39:59+00:00Added an answer on May 29, 2026 at 4:39 am

    It looks to me like $browser_lang is empty on line 153 because $_SERVER['HTTTP_ACCEPT_LANGUAGE'] is empty on line 151 and the ternary is setting the variable to to an empty string. Now when it checks for the key in $this->languages, it’s throwing your errors.

    I’m guessing this is related to calling it from the command line rather than a browser and that $_SERVER variable is not being set. I’d do a check on line 153 to see if $browser_lang is empty like this:

    // default language: first element of $this->languages
    function default_lang()
    {
        $browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
        $browser_lang = substr($browser_lang, 0,2);
        return (!empty($browser_lang) && array_key_exists($browser_lang, $this->languages)) ? $browser_lang : 'en';
    }
    

    The other option might be to have your cron job use wget instead of calling PHP directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We built a grant application system for a client. They've now asked for some
Built a custom app that will allow users to add jobs to a system.
I built a LAMP web application that let's users create their own profile page
I built an application which displays the records from database in the window and
I built a client server application using posix shared memory and posix unnamed semaphores
I built a Django application for a client about a year ago. He has
I built a windows application in C# that is very size specific. I hard
I built a very simple MVC3 application to do a little demo, but I'm
I built an application for Facebook a couple of months ago. I used the
I am currently working on a Bilingual application (English and Arabic) with struts framework.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.