in reply to Re^4: Premature end of script headers
in thread Premature end of script headers

It generates the same error in error.log

Well done. You have successfully proven that the problem is not related to perl in any way.