1

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!

3 Answers 3

4

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.

1
  • The CLI Binary is what i always use, either that or learn some bash ;)
    – grufftech
    Aug 18, 2010 at 18:14
0

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: http://www.how2dev.com/running-php-scripts-using-cron/

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!

0

You can compile PHP Scripts to Executables... http://wiki.swiftlytilting.com/Phc-win

You must log in to answer this question.