I have a file
queue.php which I have set up as a cron job. I don't want users to be able to access it. How can I do this?
Straight file permissions should do the trick. Just make the file readable by the user that cron runs as and not by anyone else.
Depending on external dependencies I usually do this by restricting the permissions on the file on the Linux side and putting the file itself outside of the public web root to guarantee it cannot be accessed by anyone except the server.
If for some reason the file cannot exist outside the web root (perhaps due to an openbasedir restriction or some kind of pathing issue) the straight unix permissions as suggested by Wesley David would do the trick.
You could also use .htaccess or even php itself to restrict how the script can be executed.