473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Run PHP file as cronjob

Hello,

I have a PHP file that reads another PHP file and writes it as a static
HTML page. I'd like to run the first PHP file as a cronjob (so that the
static HTML page is updated once an hour).

I'm familiar with scheduling a cronjob and all the PHP is working
perfectly. I don't know how to get cron to "run" a PHP file however.
Any advice would be greatly appreciated.

Jun 21 '06 #1
3 1713
Mossum wrote:
Hello,

I have a PHP file that reads another PHP file and writes it as a static
HTML page. I'd like to run the first PHP file as a cronjob (so that the
static HTML page is updated once an hour).

I'm familiar with scheduling a cronjob and all the PHP is working
perfectly. I don't know how to get cron to "run" a PHP file however.
Any advice would be greatly appreciated.


Alt 1:
If you have the CLI version of PHP installed, simply write
@hourly /path/to/php/interpreter/php /path/to/php/script.php

Alt 2:
Use wget/lynx/curl etc etc to fetch the file via the webserver. You can
then either echo the content out, and have wget/...etc save it to
wherever you want it, or you can still do this in the PHP-script, and
don't return any content to wget

--
Tommy Gildseth
http://design.twobarks.com/
Jun 21 '06 #2

Tommy,

Thank you! I tried scheduling a cron job with fetch -- and it works.

Jun 21 '06 #3
On Wed, 21 Jun 2006 12:51:08 -0700, Mossum wrote:
I'm familiar with scheduling a cronjob and all the PHP is working
perfectly. I don't know how to get cron to "run" a PHP file however.
Any advice would be greatly appreciated.


Beginning it with
#!/usr/bin/php or #!/usr/local/bin/php would be a good start. Also,
change protection to 755, so that httpd process can open it.

--
http://www.mgogala.com

Jun 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
18
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the...
7
by: sachu | last post by:
Hi, Is there is way to run a php file perodically everyday on scheduled time in such a way that there is no human interaction and it performence the written task.
1
by: Stefan Schwärzler | last post by:
hi ng, is it possible with php to search new content on internet sides with an daily php cronjob? Are there any php-tool (to search and save into xml or databases; and cronjob-tools) available?...
1
by: jan.marien | last post by:
we have a table with jobs and a table with job_history information. Users can define jobs and let them run every X minutes/hours , like a cronjob. The jobs table has the following trigger:...
4
by: coool | last post by:
Hi I'm trying to run a cronjob on a php script everything is working fine, but I'm getting my server disk space fulled up - so what's wrong here ??? how can I fix this problem ?
0
by: okonita | last post by:
Hi all, I need to learn how to create a cronjob in a Linux environment. What are the steps necessary to accomplish this. For example, I want to run daily statistics for a set of active/volatile...
5
by: Christian Schlemmer | last post by:
Hi, in a webapplication, after a submit a page is called which is processing images uploaded by the user. currently after submit a status bar will be visible (the page for the image processing...
2
by: ksrashmi | last post by:
Hi , does jar file loaidng will consume the jvm memory ? I have to run the cronjobs for some of the java files . so i have writen the .sh file ( linux server) ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.