![]() |
500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php (/showthread.php?tid=57412) |
500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-12-2013 [eluser]brianbabu[/eluser] Hi Everyone, I am having a very hard time to figure this out. I had uploaded my CMS which is developed on the CI framework. I have configured the script with the database but however i try to access the index.php file it shows up an Internal Server Error but i could access another file ini.php which is at the same location as the index.php. I do not have .htaccess at the root. Anything that i need to take care about. Please let me know. Its very urgent. I had posted this issue at daniweb and did get good response but not good enough to solve this problem. I tried to find the line of code that is creating this error by doing die("Reached index.php....gotcha!!"); and came to know that Code: call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2)); this line is creating the problem. Any idea why is it? This is located in system/core/CodeIgniter.php Is this the problem regarding the version of PHP being used? Cuz i am using WAMP which is running on PHP 5.3 and its working perfectly. the application is to be hosted on a windows environment which ofcourse is IIS7.0. I did a phpinfo() function call it didn't reveal the version of PHP. What confuses me is that i used the same CI version for another client it worked for her but for this one. Both the websites are on the same server running Windows OS. Any Suggestions guys? I am also trying to get this thing resolved from my end too because i have never dealt with such an error before. Any help would be great. THANKS!! 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]brianbabu[/eluser] Hey guys, It seems my code is fine. It was a server issue. I moved the entire files to another server with IIS installed. The website opened but i couldn't access the admin panel of the website after logging in. do you think i need to set some permissions to some folders. i am just guessing. This is the error i got after logging in. A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at D:\PLESKVHOSTS\vhosts\pdocricket.com\httpdocs\TestCMS\application\controllers\admin.php:43) Filename: libraries/Session.php Line Number: 675 A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at D:\PLESKVHOSTS\vhosts\pdocricket.com\httpdocs\TestCMS\application\controllers\admin.php:43) Filename: helpers/url_helper.php Line Number: 542 Anyone?????????????????????????????????????????????????? 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]TheFuzzy0ne[/eluser] Do you have a closing PHP tag at the end of your file? If so, you may have trailing whitespace that's causing the problem. Due to this, we recommend that you omit the closing ?> tag in every file. You may find that something is throwing an error and causing output to be sent. I suggest you check the source code that's being sent to your browser. The error may well be there. 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]brianbabu[/eluser] hey, Thanks for the reply. I have to remove the closing tags or all my controllers and models? :-O 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]TheFuzzy0ne[/eluser] You don't have to, but it can help. http://ellislab.com/codeigniter/user-guide/general/styleguide.html#php_closing_tag It's also possible that you have a whitespace before an opening PHP tag, although that's a lot less likely. It might help if we could see the code in your admin controller - particularly line 43. 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]brianbabu[/eluser] here is the whole function public function validate_credentials() { $info = array( "pagetitle" => 'Admin Panel - Login' ); $this->load->model('login_model'); $result=$this->login_model->validate(); if($result==1) { echo "We'll take you to the dashboard shortly"; $data=array( "users_id" =>$this->login_model->userinfo('users_id',$_POST['username_field'],$_POST['password_field']), "is_logged_in" =>true ); $this->session->set_userdata($data); redirect('dashboard'); } else { $data= array( 'login_error' => 'Invalid Username / Password' ); $this->load->view('admin/login_button_view',$data); } } It worked flawlessly on my PC - Wampserver. The production server is IIS instead of Apache. 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]TheFuzzy0ne[/eluser] Please could you put your code in code tags? Which is line 43? 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]brianbabu[/eluser] Oh am very sorry! I am so damn desperate right now Line 43 is $this->session->set_userdata($data); Code: public function validate_credentials() 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]TheFuzzy0ne[/eluser] I can't help thinking that the line that's causing the problem is this one: Code: echo “We’ll take you to the dashboard shortly”; Does commenting that out make any difference? Also, did you check the source code for errors being output? In most browsers it's CTRL + U to view the source. 500 Internal Server Error because of a line of code in system/core/CodeIgniter.php - El Forum - 03-13-2013 [eluser]TheFuzzy0ne[/eluser] As a work around, adding: Code: ob_start(); to the beginning of your index.php file might help with this. It should mean that anything being output too early should still be buffered, and should stop your app from breaking. |