chmod a file so that it can only be executed from the server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

chmod a file so that it can only be executed from the server

Post by klevis miho »

What rights should I give a file so that it can only be executed from the server?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: chmod a file so that it can only be executed from the server

Post by pickle »

Files are always executed on the server. If you mean you want a file that can't be run by requesting it though a browser, then you need to remove read writes from whatever user Apache runs as. Then, the script will have to be run by a user logged into the server.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: chmod a file so that it can only be executed from the server

Post by klevis miho »

I want to run a cron job on a script, but http requests on that scipt shouldnt work
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: chmod a file so that it can only be executed from the server

Post by Darhazer »

klevis miho wrote:I want to run a cron job on a script, but http requests on that scipt shouldnt work
It's best to put it outside the document root of the server. Or deny access for the user of the server, allow only for the crond :)
Post Reply