If you're getting this error from the web server, then the URL you're using to try to access your script is wrong, your script is in the wrong place, or is otherwise misconfigured. Check the error log of your server for more clues.
404 is a 'not found' error. This means that the error isn't in your script at all (although your script may indeed have errors). Your script isn't even being run.