Solved mystery – perl on XAMPP won’t run modified scripts “End of script output before headers”
Friday 4 April 2014 @ 10:20 am

Nice, WTFish riddle for You today. Imagine this – there is a XAMPP server – Windows, apache, Perl and PHP (from www.apachefriends.org) installed on your laptop.

I hope the previous sentence did not put you off, linux fans 😉

Still with me?  Read on: you have a typical hello world type perl script, serving as an example and test, that is delivered with that whole bunch.

It works. Shows “OK” via CGI.


#!"C:\xampp\perl\bin\perl.exe" 
 
print "Content-Type: text/html\n\n"; 
print "OK";

You write your own small script – get server error 500 – “End of script output before headers“.

You put your script in the same directory as that example – still get 500.

You copy your example script to other file in the same directory and edit it – 500.

You copy your example script to other file in the same directory and NOT edit it this time  – 500.

You edit your example script (that original file) , do the slightest change – for example change string to “OK2”  – 500.

You edit your example script back to be exactly as it was before – it works.

WTF?

Good text editor was used – Notepad++ (saving as UTF8 without BOM, line endings were not messed with), so it was not the cause of problems.

The problem was encountered by more than one person (1st, 2nd).

Guess where the problem was.

You can think for yourself, the answer to the riddle, cause and solution is below (scroll if you have no idea)

 

 

 

 

 

 

 

 

 

 

.

 

 

 

 

 

 

 

 

 

 

 

.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.

 

 

 

 

 

 

 

 

 

 

.

 

 

 

The antivirus/firewall program, COMODO Internet Security was causing the problem. It did not allow to run neither new perl files, nor modified existing perl files. I guess it somehow accepted the original file that was created during XAMPP installation, but when someone tried to modify it or make new one – it won’t run.

Solution – temporarily turn off sandbox feature or the whole COMODO antivirus/firewall at all. Or change it to other product.

Was searched:

Comments (1) - Posted in wtf by  



Nothing about perl today
Wednesday 14 April 2010 @ 6:27 am

Every Wednesday I write a post here. But, due to national mourning, nothing about perl today.

As you know, near the airport of Smolensk Tupolev 154-M aircraft with President Lech Kaczynski crashed. President of the Polish National Bank also died, the head of the IPN (National Memory Institute), the Sejms and Senats (both chambers of parliament) vice heads – (Putra, Bochenek, Szmajdzinski), the former president in exile Kaczorowski, presidential ministers, Chief Gen. Gągor, the ombudsman Janusz Kochanowski, wife of the President, members of Parliament (Gosiewski, Wasserman, Jaruga-Nowacka, Szymanek-Deresz and others), bishop Tadeusz Płoski and others. Probably when making the second approach to landing plane collided with trees and crashed.

A few rather obvious parallels arise:
– that in the Katyn Polish intelligentsia perished and now again, many representatives of the Polish intelligentsia died there.
– Second, the General Sikorski and his unexplained aircraft accident
– Third – that 5 years ago, in the day before the Divine Mercy Sunday, 7 days after Eastern died Pope John Paul II. This year, exactly the same vigil before that Sunday, the President and others died.

Read more of you want:
http://en.wikipedia.org/wiki/Katyn_massacre
http://en.wikipedia.org/wiki/W%C5%82adys%C5%82aw_Sikorski#Death
http://en.wikipedia.org/wiki/Divine_Mercy_Sunday

Comments (0) - Posted in wtf by  



Perl ads here
Wednesday 7 April 2010 @ 6:53 am

There ads on this blog. Really. You probably do not see it, if you use adblock for firefox or similar solution.

Turn AdBlock off and look at right column. First, there are ads about perl – form Gabor – I wrote about it here. Then a few adsense (from Google). They should match the content of this blog. And then is a link to one particular book I like very much.

And guess what? No one clicks the ads from Google. I see that in my stats. Even though those ads are matched to site content – as you can see. I doubt if anyone clicks the ads from Gabor either (by analogy – beside, I guess, most geeks use adblock and similar solutions – so they do not even see it – and those ads are intended for THEM). If you have clicked and ad here – either from Gabors perl ad server, or google – raise your hand (add a comment).

Comments (4) - Posted in wtf by  



Perl Ironman – what is going on?
Wednesday 24 March 2010 @ 6:40 am

Did someone forgot about perl ironman competition and neglects it?

See http://jquelin.blogspot.com/2010/02/ironman-challenge-status.html and http://www.lowlevelmanager.com/2010/01/perl-iron-man-challenge-is-cron-still.html

wtf?

Comments (1) - Posted in wtf by  



More on foreach localisation
Wednesday 9 September 2009 @ 6:47 am

This was first time I encountered the strange foreach localisation.

One day I was using global var in script (lame, I know). I wanted to use it in foreach. And its value magically disappeared when called other subroutine. This was strange.

This was a script to make reports for customers. The code looked like this (many parts taken out for brevity and to protect the innocent 😉 ) :

read more…

Comments (1) - Posted in wtf by  



WTFish side of using Perl talk at YAPC::EU 2009 – slides
Wednesday 26 August 2009 @ 6:52 am

I did my talk about WTF in Perl at YAPC::EU 2009 at Monday, August 3rd. It was a bit stresfull experience for me. Especially that my laptop did not want to show presentation on the projector. I turned out that I do not know my own laptop. Right, I use it rarely. Hopefully presentation was not bad, I received some positive feedback. People were clapping too. Nice 🙂 One person asked me for slides. So here they are:

Feedback about my talk is appreciated, use comment field below 🙂

Comments (3) - Posted in wtf,yapc by  



Perl WTFs – last in function
Monday 27 July 2009 @ 10:17 pm

Imagine you have a loop – and in that loop you call a function (sub) – your, or from some module. And imagine that someone by mistake left there “last” statement. What would it do? it will terminate your loop.

for … {

something…;

function();

something… that would not be executed…

};

sub function {

something something…

last; # by mistake, maybe it should be a “return”?

}

For some people it is a WTF, for some it is very logical way , that it should work like.

What do you think about it?

Comments (0) - Posted in wtf,yapc by