GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   crontabs executing PHP scripts... (https://gfy.com/showthread.php?t=386839)

Voodoo 11-11-2004 04:53 AM

crontabs executing PHP scripts...
 
5 * * * * wget --spider -q http://url_to_file.php
10 * * * * wget --spider -q http://url_to_file.php
* 1 * * * wget --spider -q http://url_to_file.php


Does this look about right if I'm running command line PHP?

notjoe 11-11-2004 04:58 AM

Quote:

Originally posted by Voodoo
5 * * * * wget --spider -q http://url_to_file.php
10 * * * * wget --spider -q http://url_to_file.php
* 1 * * * wget --spider -q http://url_to_file.php


Does this look about right if I'm running command line PHP?

That doesnt involve any PHP code at all...looks like you're spidering your URLs which end in a php script (makes no difference)

First line will run wget on the 5th minute of every hour. Second like will run on the 10th minute of every hour and the thrid will run every hour at the begining of the hour.

Hopefully this helps you out :)

PS: You may or may not need to put the full path to wget. You should be able to find the absolute path by running "which wget" without the quotes

Napolean 11-11-2004 05:00 AM

Quote:

Originally posted by notjoe
That doesnt involve any PHP code at all...looks like you're spidering your URLs which end in a php script (makes no difference)

First line will run wget on the 5th minute of every hour. Second like will run on the 10th minute of every hour and the thrid will run every hour at the begining of the hour.

Hopefully this helps you out :)

PS: You may or may not need to put the full path to wget. You should be able to find the absolute path by running "which wget" without the quotes

i think he was just looking for a yes or no, but rock on :)

Voodoo 11-11-2004 05:02 AM

Quote:

Originally posted by notjoe
That doesnt involve any PHP code at all...looks like you're spidering your URLs which end in a php script (makes no difference)

First line will run wget on the 5th minute of every hour. Second like will run on the 10th minute of every hour and the thrid will run every hour at the begining of the hour.

Hopefully this helps you out :)

PS: You may or may not need to put the full path to wget. You should be able to find the absolute path by running "which wget" without the quotes

So this will act as a "hit" on each of the URLs in said crontab, right? As if I were to open that page in a browser window.

notjoe 11-11-2004 05:03 AM

Quote:

Originally posted by Napolean
i think he was just looking for a yes or no, but rock on :)
I think he may be confused so i was just trying to clear things up :) He mentioned runing php from the command line yet in what he pasted there is no PHP program, just crontab code which doesnt attempt to run any php code :)

Voodoo 11-11-2004 05:05 AM

Quote:

Originally posted by notjoe
I think he may be confused so i was just trying to clear things up :) He mentioned runing php from the command line yet in what he pasted there is no PHP program, just crontab code which doesnt attempt to run any php code :)
Running PHP Command Line Mode. Instead of in Apache mode.

notjoe 11-11-2004 05:05 AM

Quote:

Originally posted by Voodoo
So this will act as a "hit" on each of the URLs in said crontab, right? As if I were to open that page in a browser window.
Correct, although the hit will show up as having WGET as the browser (which you can spoof if needed).

Voodoo 11-11-2004 05:07 AM

Quote:

Originally posted by notjoe
Correct, although the hit will show up as having WGET as the browser (which you can spoof if needed).
Ok, that answers my question. Spoofing not needed, I'm just trying to run a couple PHP scripts, via a crontab.

Thanks :)

notjoe 11-11-2004 05:10 AM

Quote:

Originally posted by Voodoo
Running PHP Command Line Mode. Instead of in Apache mode.
Running PHP from the command line - Executing the script via the shell terminal you're logged in to

Running PHP as a CGI - The webserver forks the process and executes the script (somewhat simular to the command line)

Running PHP as a module - APACHE internally processes the script instead of forking a process and using the php binary file to execute the script.

notjoe 11-11-2004 05:11 AM

Quote:

Originally posted by Voodoo
Ok, that answers my question. Spoofing not needed, I'm just trying to run a couple PHP scripts, via a crontab.

Thanks :)


Are the scripts located on the same server as the wget crontab?

Voodoo 11-11-2004 05:12 AM

Quote:

Originally posted by notjoe
Are the scripts located on the same server as the wget crontab?
Yes

notjoe 11-11-2004 05:16 AM

Quote:

Originally posted by Voodoo
Yes
I "think" what you want to do is something like this then :)

Find the path to the PHP binary "which php" without quotes. Then change the lines to this

5 * * * * /usr/local/bin/php /path/to/php/script.php

But only if you only want to run that script... if you still want to use wget's spidering abilities then stick to the way you've done it

Voodoo 11-11-2004 05:21 AM

Quote:

Originally posted by notjoe
I "think" what you want to do is something like this then :)

Find the path to the PHP binary "which php" without quotes. Then change the lines to this

5 * * * * /usr/local/bin/php /path/to/php/script.php

But only if you only want to run that script... if you still want to use wget's spidering abilities then stick to the way you've done it

OIC, so instead of using wget to run a PHP script, I can just point the crontab to the PHP module then the .php file and it will execute the script?

notjoe 11-11-2004 05:27 AM

Quote:

Originally posted by Voodoo
OIC, so instead of using wget to run a PHP script, I can just point the crontab to the PHP module then the .php file and it will execute the script?
Correct, as long as you have PHP installed as a binary (Command line/CGI install) then you can execute scripts against it without actually having to run them through the web server.

Hit me up on ICQ at 5956902 if you need anymore help :)

(assuming that by module you mean executable binary file which is the php parser/interrupter)

If php is installed as an APACHE module and not as a binary file then you wont be able to do it and will have to use wget/apache OR you could just install PHP as a binary file :)


All times are GMT -7. The time now is 03:10 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123