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

  • Home
  • SEARCH
  • 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 6961155
In Process

The Archive Base Latest Questions

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

I have a Yii web service actionQuery that queries a model based on four

  • 0

I have a Yii web service actionQuery that queries a model based on four parameters. There are about 1700 items to be queried total and I’m using a pretty bad web host (iPage). When I run a query with no parameters or extremely common parameters like “a” in string name, I expect to see all or almost all of the rows. Instead I get back a 500 Internal server error that is obviously not being produced by Yii, so it’s a pretty bad error. When I try to narrow it down to around 700 or 800 rows, it takes a while but it gets done. How can I correct this error of large data sets producing 500 internal server errors? Is it a max execution time issue? Is there something I need to be doing differently with CDBCriteria?

Here is actionQuery, which is admittedly coded quite poorly.

 public function actionQuery()
    {
                $this->_checkAuth();

        switch ($_GET['model'])
                {
                        case 'dogFood':
                                $criteria = new CDbCriteria();
                                if ($_GET['name'] && $_GET['name'] !== '0') {
                                        $criteria->addSearchCondition('name_df', $_GET['name']);
                                }
                                if ($_GET['ingredients'] && $_GET['ingredients'] !== '0') {
                                        $ingredientsArray = explode(',',$_GET['ingredients']);
                                        foreach ($ingredientsArray as $ingredient) {
                                                $criteria->addSearchCondition('ingredients_df', $ingredient);
                                        }
                                }
                                if ($_GET['brand'] && $_GET['brand'] != 0) {
                                        $criteria->addColumnCondition(array('brand_df' => $_GET['brand']));
                                }
                                if ($_GET['brandstring'] && $_GET['brandstring'] !== 0) {
                                        $criteriaForBrand = new CDbCriteria();
                                        $criteriaForBrand->addSearchCondition('name_dfb', $_GET['brandstring']);
                                        $brandInQuestion = DogfoodbrandDfb::model()->find($criteriaForBrand);
                                        $brandId = $brandInQuestion->id_dfb;
                                        $criteria->addColumnCondition(array('brand_df' => $brandId));
                                }
                                $models = DogfoodDf::model()->findAll($criteria);
                                break;
                        default:
                                $this->_sendResponse(501, sprintf(
                                        'Error: Mode <b>query</b> is not implemented for model <b>%s</b>',
                                        $_GET['model']));
                                exit;
                }

                if (empty($models)) {
                        $this->_sendResponse(200,
                                sprintf('No items were found for model <b>%s</b>', $_GET['model']));
                }
                else {
                        $rows = array();

                        foreach ($models as $model) {
                                $rows[] = $model->attributes;
                        }

                        $this->_sendResponse(200, CJSON::encode($rows));
                }
    }
  • 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-27T15:29:40+00:00Added an answer on May 27, 2026 at 3:29 pm

    Most likely you are running out of memory. There is a limit set how much memory a PHP program can use: you should see memory exceeded messages in your error.log.

    You can try and up the allowed memory for a thread, or for this specific script, but verify in your error log first that this is the issue.

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

Sidebar

Related Questions

I have started using Yii framework and I have a -newbie- question about the
I'm working on a large PHP (Yii framework) web application where users have accounts
i have a yii site that contains main layout. in this main layout file
I have created a Yii command that needs to be run every month. If
I'm use Yii Framework. I have a named anchor <a name=projet>projet</a> in about.php page.
I have a Yii controller action that can potentially return a very large set
I have added simpleopenidselector and lightopenid to my Yii web app and it does
I have found a few articles online about debugging Yii (PHP) applications either locally
I have a PHP Yii application that uses an RSS feed reader. I wanted
I am using YII framework for my web application . I have a question

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.