When you accessed the script with the browser, what errors did you get in the Error Log in cPanel as shown here Error Log
In reply to Re^13: global var by poj in thread global var by tultalk