Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking to run a PHP script with a cron job, but it seems I don't have a PHP binary. Looks like I don't have PHP installed as a CGI, so without reinstalling/configuring my PHP, what is the best way to run a php file? I would prefer to not have the file public facing, so some solutions like wget seem a bit hacked. Thank you!

share|improve this question

You are going to have to pick one. Install the cli/cgi binary or use wget/curl to make a request to your web server.

If you want to protect the script you could adjust the configuration of the web server to block access except from local host, or add something to the script to return an error if the request didn't originate from the local host.

Of course you could also translate the script into something else, but if you need to use libraries common to a web app this is probably not worth the effort.

share|improve this answer
The CLI Binary is what i always use, either that or learn some bash ;) – GruffTech Aug 18 '10 at 18:14

Looks like I will just protect it, as Zoredache mentioned. For future peeps here is a good link that answered most of my questions about the Apache module vs. CGI binary:

My only concern was that a public facing link would not be immune to denial of service attacks, but only allowing localhost sounds like the answer to mitigate that. Thank you!

share|improve this answer

You can compile PHP Scripts to Executables...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.