<? set_time_limit(0); ini_set('memory_limit', '-1'); // или поставь сколько хочешь $f = fopen('file.txt', 'r'); $count = explode("\r\n", $f); echo count($count)+1; ?>