Welcome Guest, Not a member yet? Register   Sign In
500 with simple syntax errors...
#1

[eluser]kb1ibh[/eluser]
Whenever im working on a site in Codeigniter i create a new Vmware Virtual Machine, install debian, apache2, mysql-server, and execute a2enmod rewrite for .htaccess mod-rewrite... i've got a standard copy of CI that i use that has all my defaults setup already (configs, db, etc) so i can just copy and go...

on the latest server i created, i've been getting 500 errors for the simplest of syntax mistakes, and im forced to go into /var/log/apache2 to find out what the error was (this time i misspelled the name of a model function...)

when im in a development environment of CI im used to getting these errors through the browser, instead of having to navigate through debian to figure out whats going on... i know i had fixed this somehow before, but i have no idea what i did in the past to change it...

anyone know how to change this behavior? getting annoying every time i miss a semicolon...
#2

[eluser]kb1ibh[/eluser]
Fixed it... just have to add one of these:

Code:
ini_set('display_errors','On');
As in...
Code:
// index.php
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
  case 'development':
   ini_set('display_errors','On');
   error_reporting(E_ALL);
  break;

  case 'testing':
   error_reporting(0);
  break;
  
  case 'production':
   error_reporting(0);
  break;

  default:
   exit('The application environment is not set correctly.');
}
}
#3

[eluser]InsiteFX[/eluser]
500 are server errors and nothing to do with CodeIgniter, check your server setup and installation.
#4

[eluser]Kenneth Vogt[/eluser]
While it is correct to say that 500 errors are server errors, it is not correct to say it has nothing to do with CodeIgniter. A coding mistake can easily result in a 500 error. For instance, attempt to autoload a library where the library class is missing its closing bracket: you get a 500 error.
#5

[eluser]InsiteFX[/eluser]
Quote:HTTP Error 500 Internal server error

Introduction

The Web server (running the Web Site) encountered an unexpected condition that prevented it from fulfilling the request by the client (e.g. your Web browser) for access to the requested URL.

This is a 'catch-all' error generated by the Web server. Basically something has gone wrong, but the server can not be more specific about the error condition in its response to the client. In addition to the 500 error notified back to the client, the Web server should generate some kind of internal error log which gives more details of what went wrong. It is up to the operators of the Web server site to locate and analyse these logs.

500 errors in the HTTP cycle

Any client (e.g. your Web browser) goes through the following cycle when it communicates with the Web server:
•Obtain an IP address from the IP name of the site (the site URL without the leading 'http://'). This lookup (conversion of IP name to IP address) is provided by domain name servers (DNSs).
•Open an IP socket connection to that IP address.
•Write an HTTP data stream through that socket.
•Receive an HTTP data stream back from the Web server in response. This data stream contains status codes whose values are determined by the HTTP protocol. Parse this data stream for status codes and other useful information.

This error occurs in the final step above when the client receives an HTTP status code that it recognises as '500'. (Last updated: March 2012).

Fixing 500 errors - general

This error can only be resolved by fixes to the Web server software. It is not a client-side problem. It is up to the operators of the Web server site to locate and analyse the logs which should give further information about the error.
#6

[eluser]Aken[/eluser]
Depending on how the server interprets a PHP install, a PHP error can throw a 500 error also. The 500 error states that it is not a client-side problem, which means it's something to do with the server set up and/or software, which can certainly include PHP.

I've personally never experienced a 500 error that resulted from poor PHP code, but I can see how certain set ups may cause it. MIne usually come from crappy .htaccess files.
#7

[eluser]InsiteFX[/eluser]
Me either, I only get a server 500 error if my server is installed wrong or an error in my .htaccess file!




Theme © iAndrew 2016 - Forum software by © MyBB