The script wasn't working fine on the linux machine, you just disn't see the errors.
In PHP you can define which errors should be reported and which should be hidden. Check the php.ini and read the manual about error_reporting().
Note: it is NEVER a good idea to set the error-reporting lower.
Each and every warning you get should be fixed, especially the 'undefined variable' warnings. They basically mean that you are using a variable without first putting a value in them, which is dangerous.