Reputation: 909
I am using zend framework btw and i have implemented a ZendX_JQuery_Form_Element_AutoComplete. It works as expected on my local system but on the live server, when i start typing, it gives me a 500 Internal Server Error. I have had this problem for 3 days now and i have googled and read quite few solutions.
Hope someone can help.
Both server and dev system run Ubuntu and i have tried to keep the same setup on both systems.
Edit:
I have checked the links and the permission as suggested and the problem still persists. So what i did was to literally run the code line-by-line and i came to the following line in the controller that triggers the error 500:
$response = $groupsmapper->search($this->getRequest()->getParam('term'));
below is the complete function
public function getallgroupnamesAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->getHelper('layout')->disableLayout();
$groupsmapper = new Application_Model_GroupsMapper();
$response = $groupsmapper->search($this->getRequest()->getParam('term'));
$json = Zend_Json::encode(array_values($response));
echo $json;
}
and the search method of the groupsmapper is like so
public static function search($term)
{
$groupsmapper = new Application_Model_GroupsMapper();
$response = $groupsmapper->getDbTable()->fetchAll(
$groupsmapper->getDbTable()
->select()
->distinct()
->from(array('groups'), array('group_name'))
);
$no_groups = count($groups_array = $response->toArray());
for ($x = 0; $x < $no_groups; $x++)
{
$groups[] = $groups_array[$x]['group_name'];
}
$filter = function($group) use ($term)
{
if(stristr($group, $term))
return true;
return false;
};
return array_filter($groups, $filter);
}
I really hope you guys can spot something, other wise the alternatives are to use a select element but the list will be too long or let the user type the name and click a submit button to search. that too is not ideal as the spellings are not common or easy to figure out hence the query might not always workout.
Upvotes: 1
Views: 1335
Reputation: 432
You can remove the Callback functions by commenting the following lines of code
/* //lines to comment
$filter = function($group) use ($term)
{
if(stristr($group, $term))
return true;
return false;
};
return array_filter($groups, $filter);
*/
Include your own function and pass it over the callback function surely it will work. I had overcome the same problem by using the following lines.
//New lines to include
function filtergroup()
{
return true;
}
return array_filter($groups, $filtergroup);
Upvotes: 0
Reputation: 21957
try to check your paths. Maybe on local server your paths are right, but on real server this path is wrong. The good practice to use absolute paths. In Zend Framework in index.php you can declare ROOT_PATH and other paths. On others pages, when you include some files use this global variables. Server can not find file on server (500 internal error). Sorry for my english.
Upvotes: 1
Reputation: 4315
Check the chmod
for the file(s) running on the server. My guess is the permissions got set to something that your hosting isn't approving of.
Upvotes: 1