LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-07-2013, 04:13 AM   #1
Companion
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Rep: Reputation: Disabled
HTTP Error 500 - Segfault 11 Debian 6.0 Squeeze


Hello there,

I am currently having an issue with one of my websites hosted on my private server, several scripts are giving error 500 pages. The files may be corrupted personally I checked all MD5's on the files and their no longer corrupted after I have fixed them.

The following things are popping up in the logs:
/home/domain/logs/error
Quote:
[error] [client 84.106.XX.XX] Premature end of script headers: prison.php, referer: http://domain.com/public/prison.php
[warn] [client 84.106.XX.XX] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://domain.com/public/prison.php
/var/log/apache2/error.log
Quote:
[Mon Jan 07 12:08:15 2013] [error] mod_fcgid: process /home/domain/fcgi-bin/php5.fcgi(36449) exit(communication error), get unexpected signal 11
[Mon Jan 07 12:08:21 2013] [error] mod_fcgid: process /home/domain/fcgi-bin/php5.fcgi(36453) exit(communication error), get unexpected signal 11

Last edited by Companion; 01-08-2013 at 09:30 AM.
 
Old 01-07-2013, 08:01 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Companion View Post
Code:
mod_fcgid: process /home/domain/fcgi-bin/php5.fcgi(..) exit(communication error), get unexpected signal 11
mod_fcgid: process /home/domain/fcgi-bin/php5.fcgi(..) exit(communication error), get unexpected signal 11
Apart from a rather terse log (I doubt that's the only errors that got logged) signal 11 means segmentation fault. Upload some newly made, simple, clean PHP file to test, else examine which configuration settings (httpd.conf, php.ini, my.cnf, .htaccess, etc, etc), includes and files to be served your "fixing" touched. Also if "corruption" means your site(s) suffered unwanted I-frame modifications best first address the cause for that.
 
Old 01-07-2013, 08:21 AM   #3
Companion
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
Apart from a rather terse log (I doubt that's the only errors that got logged) signal 11 means segmentation fault. Upload some newly made, simple, clean PHP file to test, else examine which configuration settings (httpd.conf, php.ini, my.cnf, .htaccess, etc, etc), includes and files to be served your "fixing" touched. Also if "corruption" means your site(s) suffered unwanted I-frame modifications best first address the cause for that.
Ive been testing and checking things out on my server, other sites run perfectly fine it seems to be this specific ones. When I remove the client from the table 'inmate' they simply can resume using the website. It seems to be an error in the PHP File or The MySQL Database which causes this.

When adding my self to the table I simply get the error 500 when it tries to 'remove' me from the cool down and I hit refresh. Which makes it obviously it is an error generated trough the 'prison.php'

The Error:

Code:
[Mon Jan 07 15:56:19 2013] [notice] child pid 56406 exit signal Segmentation fault (11)
[Mon Jan 07 15:56:23 2013] [notice] child pid 55651 exit signal Segmentation fault (11)
[Mon Jan 07 15:56:27 2013] [notice] child pid 56387 exit signal Segmentation fault (11)
[Mon Jan 07 15:56:31 2013] [notice] child pid 56409 exit signal Segmentation fault (11)
[Mon Jan 07 15:56:36 2013] [notice] child pid 54788 exit signal Segmentation fault (11)
[Mon Jan 07 16:04:18 2013] [notice] child pid 56379 exit signal Segmentation fault (11)
[Mon Jan 07 16:04:22 2013] [notice] child pid 56804 exit signal Segmentation fault (11)
[Mon Jan 07 16:04:27 2013] [notice] child pid 56834 exit signal Segmentation fault (11)
[Mon Jan 07 16:04:32 2013] [notice] child pid 56439 exit signal Segmentation fault (11)
For your refference I will add the 'prison.php' to this post in a code tag.

Code:
<?php
        require_once('../include/init.php');

        if (!$account or !$account->getProfile()->id) Tools::redirect('/');
        else Profile::activityOn($account->getProfile()->id);

        $profile = $account->getProfile();
        $_errors = array();

        if (!Prison::check($profile->id)) Tools::redirect('/'); // Get out of jail if not there...
        else $inmate = Prison::getInmate($profile->id);

        $variables = array(
                'profile' => $profile,
                'account' => $account,
                'current_time' => date('H:i:s d M Y'));

        // Global game settings
        $global_settings = new GameSettings();
        $variables['global_settings'] = $global_settings;

        if ($messages = Message::getAmount($profile->id)) $variables['unread_messages'] = $messages.' new';
        if ($online_contacts = Contact::getNumber($profile->id, true)) $variables['online_contacts'] = $online_contacts.' online';
        if ($alerts = Alert::getAmount($profile->id)) $variables['unread_alerts'] = $alerts. 'new';

        $condition = new ProfileCondition($profile->id);
        $stats = new ProfileStats($profile->id);

        // Actions
        if ($id_profile = Tools::getValue('attack')) {
                $target_condition = new ProfileCondition($id_profile);
                if ($condition->energy < 40) {
                        $_errors []= 'Error #PSN0010: '.FRONT_ERROR_PSN0010;
                } elseif (!$inmate->shank) {
                        $_errors []= 'Error #PSN0003: '.FRONT_ERROR_PSN0003;
                } elseif (!Prison::check($id_profile, $condition->location)) {
                        $_errors []= 'Error #PSN0001: '.FRONT_ERROR_PSN0001;
                } elseif ($id_profile == $profile->id) {
                        $_errors []= 'Error #PSN0002: '.FRONT_ERROR_PSN0002;
                } elseif (!$target_condition->canAttack()) {
                        $_errors []= 'Error #PSN0011: '.FRONT_ERROR_PSN0011;
                } else {
                        $condition->change('energy', $condition->energy - 40);

                        if (Tools::probability($stats->fighting - 1)) {
                                $profile_condition_other = $target_condition;
                                $profile_other = new Profile($id_profile);

                                $result = $profile_condition_other->shank_attack($stats->fighting == 100 and rand(0,100) == 77);

                                if ($result['dead']) {
                                                // Update statistics...
                                                $stats->setStatistic('kills', $stats->statistics['kills'] + 1);
                                                $stats->saveStatistics();
                                                // Set death method to the prison method
                                                $method = ProfileCondition::getDeathMethods(true);
                                                FuneralHome::getByField(array('id_profile' => $profile_condition_other->id_profile))->setReason($method);
                                                // 25% chance of guards seeing you... and increasing the sentence...
                                                if (Tools::probability(25)) {
                                                        $inmate->increaseSentence(Prison::getSentence(CRIME_MURDER_IN_PRISON), CRIME_MURDER_IN_PRISON);
                                                        $alert_variables = array(); // Clear the variables...
                                                        $alert_variables['profile'] = $profile_other;
                                                        $alert_variables['action'] = 'prison_guards';
                                                        Alert::generate($profile->id, Alert::prepare($alert_variables, 'attack'));
                                                }
                                        // See if there was a contract around for this guy
                                        $contract = Contract::getByField(array('id_profile' => $profile_other->id));
                                        if ($contract->id) {
                                                $condition->change('cash', $condition->cash + $contract->amount);
                                                $alert_variables = array(); // Clear the variables...
                                                $alert_variables['profile'] = $profile_other;
                                                $alert_variables['amount'] = $contract->amount;
                                                $alert_variables['action'] = 'contract';
                                                Alert::generate($profile->id, Alert::prepare($alert_variables, 'attack'));
                                                $contract->delete();
                                        }
                                }

                                $alert_variables = array();

                                if ($result['dead']) {
                                        $variables['success'] = 'You delivered a <u>fatal</u> blow to '.$profile_other->name;
                                        $alert_variables['hit'] = $result['damage'];
                                }

                                $alert_variables['profile'] = new Profile($stats->id_profile);
                                $alert_variables['action'] = 'attack';
                                Alert::generate($profile_condition_other->id_profile, Alert::prepare($alert_variables, 'prison'));
                        } else {
                                $fails = array();
                                $fails []= ' made you drop the shank...';
                                $fails []= ' gave you a hard beating of his own...';
                                $fails []= ' ran away...';
                                $fails []= ' screamed and the guards came your way.';
                                $variables['failure'] = $profile_other->name.$fails[array_rand($fails)];
                        }
                }
        } elseif ($id_profile = Tools::getValue('rape')) {
                if ($condition->energy < 40) {
                        $_errors []= 'Error #PSN0008: '.FRONT_ERROR_PSN0008;
                } elseif (!Prison::check($id_profile, $condition->location)) {
                        $_errors []= 'Error #PSN0001: '.FRONT_ERROR_PSN0001;
                } elseif ($id_profile == $profile->id) {
                        $_errors []= 'Error #PSN0009: '.FRONT_ERROR_PSN0009;
                } else {
                        $condition->change('energy', $condition->energy - 40);

                        $inmate_other = PrisonInmate::getByField(array('id_profile' => intval($id_profile)));
                        $profile_other = new Profile($id_profile);

                        if (Tools::probability($stats->robbery - 1)) {
                                $robbed = round($inmate_other->cash * 0.05);
                                $inmate_other->cash -= $robbed;
                                $inmate_other->save();

                                $inmate->cash += $robbed;
                                $inmate->save();

                                if ($robbed) {
                                        $variables['success'] = 'You stole $<b>'.$robbed.'</b> from '.$profile_other->name;
                                        // Send out an alert...
                                        $alert_variables['cash'] = $robbed;
                                        $alert_variables['profile'] = new Profile($stats->id_profile);
                                        $alert_variables['action'] = 'rape';
                                        Alert::generate($inmate_other->id_profile, Alert::prepare($alert_variables, 'prison'));
                                } else $variables['failure'] = $profile_other->name.' didn\'t have any cash on him...';
                        } else {
                                $fails = array();
                                $fails []= ' was surrounded by his crew, you couldn\'t do it...';
                                $fails []= ' gave you a hard beating of his own...';
                                $fails []= ' ran away...';
                                $fails []= ' screamed and the guards came your way.';
                                $variables['failure'] = $profile_other->name.$fails[array_rand($fails)];
                        }
                }
        } elseif (Tools::getValue('shank', 'null') != 'null') {
                if ($inmate->cash < 1000000) {
                        $_errors []= 'Error #PSN0004: '.FRONT_ERROR_PSN0004;
                } elseif ($inmate->shank) {
                        $_errors []= 'Error #PSN0005: '.FRONT_ERROR_PSN0005;
                } else {
                        $inmate->buyShank();
                        $variables['success'] = 'You have a <b>Shank</b>... quick hide it...';
                }
        } elseif (Tools::getValue('smokes', 'null') != 'null') {
                if ($inmate->cash < 1000) {
                        $_errors []= 'Error #PSN0006: '.FRONT_ERROR_PSN0006;
                } elseif ($condition->health >= 100) {
                        $_errors []= 'Error #PSN0007: '.FRONT_ERROR_PSN0007;
                } else {
                        $inmate->cash -= 1000;
                        $inmate->save();
                        $condition->change('health', 100);
                        $variables['success'] = 'Good as new...';
                }
        } elseif (Tools::getValue('getout', 'null') != 'null') { // DEBUG CHEATS
                $inmate->checkOut($condition);
                Tools::redirect('/');
        } elseif (Tools::getValue('check', 'null') != 'null') {
                if (!Prison::check($profile->id)) Tools::redirect('/');
        } elseif (Tools::getValue('cash', 'null') != 'null') {
                $inmate->cash += 5000000;
                $inmate->save();
                $variables['success'] = 'Here ya\' go!';
        $variables['inmate_self'] = $inmate;
        $variables['inmates'] = PrisonInmate::getAll($condition->location);

        $variables['condition'] = $condition;
        $variables['stats'] = $stats;

        $variables['prison_errors'] = $_errors;
        $variables['in_prison'] = Prison::check($profile->id);

        $template = $twig->loadTemplate('prison.html');
        $template->display($variables);
Is there a way to debug the specific file?
 
Old 01-08-2013, 01:37 AM   #4
Companion
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
After a longer research it is not the php files, have been checking the entire code and it is flawlessly running. So it is still server side...

Any one got an idea?
 
Old 01-08-2013, 09:27 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Companion View Post
Ive been testing and checking things out on my server, other sites run perfectly fine it seems to be this specific ones. When I remove the client from the table 'inmate' they simply can resume using the website. It seems to be an error in the PHP File or The MySQL Database which causes this.
You haven't told us what it exactly is you tested, if there's more clues in the error log files and if you examined other file you "fixed" including any configuration settings. Maybe check settings and stuff with a site that works OK. Else you'll have to make all services log verbose or in debug mode to gather more nfo.
 
Old 01-08-2013, 09:30 AM   #6
Companion
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
You haven't told us what it exactly is you tested, if there's more clues in the error log files and if you examined other file you "fixed" including any configuration settings. Maybe check settings and stuff with a site that works OK. Else you'll have to make all services log verbose or in debug mode to gather more nfo.
There was not much in the error log beside the segfault error, the issue is solved by editing the prison.php was not functioning as intended.

Short explanation of the caused error:
The error was generated trough a class error within the execution of the prison.php in order to solve it a peace of code had to be changed in the PHP Program.

[SOLVED]
 
Old 01-08-2013, 12:15 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
WD fixing things yourself & marking the thread solved.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Webacula 5.5.1 give an http 500 error WhoAmI99 Linux - Server 3 09-27-2012 06:46 AM
[SOLVED] Apache:HTTP 500 error sunrised24 Linux - Server 1 02-17-2012 12:23 PM
tcsh segfault, Debian squeeze kaz2100 Debian 2 10-01-2009 07:21 AM
monodoc-http gives a http 500 internal server error ernesto_cgf Linux - Software 0 05-10-2007 03:48 PM
http status 500 error pattar Linux - Software 1 02-18-2003 03:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration