I was hoping you could help me out

I've used the search tool and think i know what I need to do ini_set to aleviate my timeout errors but I'm having issues with the code placement.
The default timout on my server is 90 sec. I can override it with
ini_set("max_execution_time","300")
but i'm getting an error putting this code at the top of uploadphoto.php
//set override timout to 5 min.
ini_set("max_execution_time","300")
define( 'THIS_SCRIPT', "uploadphoto" );
require "pp-inc.php";
Do I have it in the wrong spot or file?
Many thanks