web server to read file from SD card and show its content as HTML

What Arduino are you using? I am testing this on a Mega 2560, and it is showing that code has barely enough SRAM to run on an Uno. Maybe you are running out of SRAM.