473,569 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1721
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
3911
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 them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in...
18
9082
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 data, imports it into a mySQL database and deletes the .csv-file after the import. so far, so good. but in some cases the cronjobs starts...
7
4418
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
1111
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? thx, steff
1
3346
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: CREATE TRIGGER JOBS_AFTER_DELETE AFTER DELETE ON JOBS REFERENCING OLD AS o FOR EACH ROW MODE DB2SQL BEGIN ATOMIC
4
2055
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
1074
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 tables before a specific application is executed that access those tables. Every piece of information and examples will be highly appreciated. ...
5
1564
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 runs in an iframe) and after image processing the page makes an redirect. if there are many images, the processing needs some time and if the user is...
2
3442
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) This is the Script file temp_path=/bin:/usr/sbin:/usr/bin export temp_path
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.