FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Cronjob Apache module v CGI
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Cronjob Apache module v CGI [message #170613] Wed, 10 November 2010 10:49 Go to next message
webmaster is currently offline  webmaster
Messages: 5
Registered: October 2010
Karma: 0
Junior Member
I seem to remember strong opinions were expressed (possibly by Jerry
Stuckle) over which was best for running cronobs and I think at the time I
nodded and thought they were very valid points. I think CGI was the way to
go?

I'm about to build a script to query the sessions database and clean up
reserved items that the customer didn't follow through on.

I currently have PHP running as an Apache module and I'm not as comfortable
as I'd like to be in Linux so would like to avoid fiddling if the security
implications are not overwhelmingly pro-CGI.

As a side, and this will undoubtedly reveal the level of my Linux/Apache
ignorance, is it possible to have PHP bound into Apache for the customer
facing/HTTP side of things and also create a CGI interface for the cronjobs?

--
+mrcakey
Re: Cronjob Apache module v CGI [message #170614 is a reply to message #170613] Wed, 10 November 2010 11:14 Go to previous messageGo to next message
Willem Bogaerts is currently offline  Willem Bogaerts
Messages: 8
Registered: September 2010
Karma: 0
Junior Member
I would run scripts as scripts and web pages as web pages. It would
surprise me if PHP was not also installed as CLI interpreter. Just open
a terminal on the machine and type:

php -v

This will show the PHP version of the CLI interpreter or a message
"command not found" if it is not installed.

But if you want to call it as a web page, you can use a simple browser,
like lynx or wget in the CRON job.

In both cases, note that CRON sees output as something that went
possibly wrong and will try to mail it to you. So you better redirect
the output of the browser or the script to a log file.

Personally, I would just use a PHP script and not use a browser from
CRON if I don't need it.

Good luck,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Re: Cronjob Apache module v CGI [message #170615 is a reply to message #170613] Wed, 10 November 2010 11:35 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 11/10/2010 5:49 AM, +mrcakey wrote:
> I seem to remember strong opinions were expressed (possibly by Jerry
> Stuckle) over which was best for running cronobs and I think at the time I
> nodded and thought they were very valid points. I think CGI was the way to
> go?
>
> I'm about to build a script to query the sessions database and clean up
> reserved items that the customer didn't follow through on.
>
> I currently have PHP running as an Apache module and I'm not as comfortable
> as I'd like to be in Linux so would like to avoid fiddling if the security
> implications are not overwhelmingly pro-CGI.
>
> As a side, and this will undoubtedly reveal the level of my Linux/Apache
> ignorance, is it possible to have PHP bound into Apache for the customer
> facing/HTTP side of things and also create a CGI interface for the cronjobs?
>
> --
> +mrcakey
>
>

It wasn't I - I have no problem with cron jobs in general; I do have a
problem with the misuse of cron jobs (or other things), but that doesn't
seem to be the problem here.

As long as your hosting company allows you to run cron jobs, this seems
like a good way to go. PHP runs fine as a CLI application as well as
under a web server. And I've never seen a server where just one is
installed (although it's possible, I guess).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Cronjob Apache module v CGI [message #170616 is a reply to message #170613] Wed, 10 November 2010 13:38 Go to previous message
Matthew Leonhardt is currently offline  Matthew Leonhardt
Messages: 9
Registered: November 2010
Karma: 0
Junior Member
"+mrcakey" <webmaster(at)listyblue(dot)com> wrote in message
news:ibdtco$god$1(at)news(dot)albasani(dot)net...
> I seem to remember strong opinions were expressed (possibly by Jerry
> Stuckle) over which was best for running cronobs and I think at the time I
> nodded and thought they were very valid points. I think CGI was the way to
> go?

Methinks you're confusing CGI (Common Gateway Interface) with CLI (Command
Line Interface).

> I'm about to build a script to query the sessions database and clean up
> reserved items that the customer didn't follow through on.
>
> I currently have PHP running as an Apache module and I'm not as
> comfortable as I'd like to be in Linux so would like to avoid fiddling if
> the security implications are not overwhelmingly pro-CGI.

Running CLI scripts is entirely independant of apache. Why would you need
to involve a web server in a background script?

> As a side, and this will undoubtedly reveal the level of my Linux/Apache
> ignorance, is it possible to have PHP bound into Apache for the customer
> facing/HTTP side of things and also create a CGI interface for the
> cronjobs?

I suppose it's possible, but I can't think of a good reason to do it. Try
the following at the command line:

which php

Should tell you if you have a php CLI binary installed. It's usually in
/usr/bin/php or /usr/local/bin/php, depending on your installation.

then, you can run any of your scripts like so:

php scriptName.php arg1 arg2
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Most efficient way to randomize a quiz from a database
Next Topic: freelancer looking for web-development projects
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 18:11:23 GMT 2024

Total time taken to generate the page: 0.02992 seconds