Welcome Guest, Not a member yet? Register   Sign In
Strange Errors in Code Igniter, Internal 500, Connection Interrupted? AHHH!

YES! What a strange error, I tracked it down to one function. Very very strange. Basically I made a helper function for the view to test if variables existed or not with less code:

function valor(&$var,$default=null){
return (isset($val) && $val!='')? $val : valor($default);

I don't know why I called valor again or why I had default set to reference, but apparently trying to pass $default, which was null, back into itself caused php to crash.

I changed it to this to fix it:

function valor(&$var,$default=null){
return (isset($val) && $val!='')? $val : $default;

I'll probably go back to using if(isset($val) && $val!='') if anything breaks again. Not sure why it crashes php/apache like that instead of giving me an error saying i must pass a variable. Glad this is all over though. Now I can wipe this look off my face :ahhh:


Original Thread:

I can't seem to find the source of this error it's very confusing, basically I've been getting internal 500 errors on random pages on my site, this only started happening recently, but I made no changes to .htaccess. Also, there are some other very odd things on my localhost. Here's an example.

My main page works fine, it works with index.php also, but if i try to go to for instance mysite.com/index.php/buy which exists. It gives me this error:

"Connection Interrupted

The connection to the server was reset while the page was loading.

The network link was interrupted while negotiating a connection. Please try again."

It almost seems like something is wrong with my installation of WAMP? Also, here's where my mind is blown, if i try to go to any localhost page besides the main page it trys to connect to www.localhost.com...

Whats even more frustrating is some internal pages work like.

Works just fine. But:


Gives me a connection interrupted. Anyone have any ideas of where I should even start to look? Also here is my .htaccess file:

Options +FollowSymLinks
Options -Indexes

DirectoryIndex index.php

RewriteEngine on

RewriteCond $1 !^(index\.php|public|tmp|ppc|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

# Rewrite mysite.com/index.php to mysite.com/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,8}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1mysite [R=301,L]

<FilesMatch "\.(php|html?)$">
php_value memory_limit 20000000

If I remove .htaccess and try to go to

It trys to connect to www.localhost.com again.


works but


tries to connect to www.localhost.com

Then lastly, as if it wasn't confusing enough for me some buy/other-product pages DO work.. It's just random. Also when I uploaded the files to HostGator the buy page is accessible as well as the /articles page... Also when its uploaded, some product pages show while others give me an internal 500 error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.41 Server at www.mysite.com Port 80

Also, here is the error that shows up in my HostGator logs (ip hidden):
[Wed Aug 27 11:29:27 2008] [error] [client] Premature end of script headers: /home/whatthef/public_html/index.php

Any help would be greatly appreciated, if I need to post anymore info plz tell me. I'm gonna restart my computer now just to make sure I've tried everything.


I just got this back from someone at hostgator. This is way beyond my scope of knowledge so I'm just looking for any information about it, here's the full response it has some info that could help.

The pages that are producing the internal server errors are causing segmentation faults in PHP. I wasn't able to find any specific cause relating to the server configuration. There have been no recent changes to PHP. The following are the contents of some of the core dumps. They may help you or the developer track down the cause of the crashes.

Core was generated by `/usr/bin/php /home/mysite/public_html/index.php'.

Program terminated with signal 11, Segmentation fault.

#0 0x082bf9df in zend_hash_quick_exists (ht=0xb7015854, arKey=0xb775e2a0 "default", nKeyLength=8, h=0)

at /home/cpeasyapache/src/php-5.2.6/Zend/zend_hash.c:961

961 /home/cpeasyapache/src/php-5.2.6/Zend/zend_hash.c: No such file or directory.

in /home/cpeasyapache/src/php-5.2.6/Zend/zend_hash.c

Core was generated by `/usr/bin/php /home/mysite/public_html/index.php'.

Program terminated with signal 11, Segmentation fault.

#0 _zend_hash_quick_add_or_update (ht=0xb77bbd60, arKey=0x8 <Address 0x8 out of bounds>, nKeyLength=Cannot access memory at address 0xbf552ff8


at /home/cpeasyapache/src/php-5.2.6/Zend/zend_alloc.h:80

80 /home/cpeasyapache/src/php-5.2.6/Zend/zend_alloc.h: No such file or directory.

in /home/cpeasyapache/src/php-5.2.6/Zend/zend_alloc.h

Core was generated by `/usr/bin/php /home/mysite/public_html/index.php'.

Program terminated with signal 11, Segmentation fault.

#0 0x0829eeef in _zend_mm_alloc_int (heap=0x8675350, size=Variable "size" is not available.

) at /home/cpeasyapache/src/php-5.2.6/Zend/zend_alloc.c:804

804 /home/cpeasyapache/src/php-5.2.6/Zend/zend_alloc.c: No such file or directory.

in /home/cpeasyapache/src/php-5.2.6/Zend/zend_al

Theme © iAndrew 2016 - Forum software by © MyBB