Hello, I know this is a common question, but I tried to search before ask a question, so pls don't mind.
I'm trying to create a cron job that will execute a php script.
The ideea is that I don't know where to put the script. I mean I know into wich directory I want but I don't know what would be the path for it.
So here is what I see in my FTP program
domain.com
[etc]
[mail]
[public_html]
+ my_dir_1
+ my_dir_2
+ cgi-bin
[public_ftp]
[tmp]
I would like to put my script cronjob_script.php into public_html/my_dir_1
I use CPanel 10, and when I click Cronjobs icon, I am redirected to a page where I have to choose from Standard and Advanced.
I choose Standard, and there is a Entry 1 filed where I am supposed to enter Command to run.
My question is what is that Command, considering where I want to put my script.
Thx in advance and sorry for repeating (maybe) the post
cronjob need help
Moderator: General Moderators
Your script can reside anywhere on the server. When you create your cron job specify the script path.
for example
13,18,23,28 5 * * Mon-Fri /path/to/my/php/file.php
http://floppix.ccai.com/cron.html
for example
13,18,23,28 5 * * Mon-Fri /path/to/my/php/file.php
http://floppix.ccai.com/cron.html
- Think Pink
- Forum Contributor
- Posts: 106
- Joined: Mon Aug 02, 2004 3:29 pm
That's correct. However, you'll probably have to specify entire path to the file. If you don't know the path you can do this.
Create a dummy.php
and put it in the same directory where you want my_cron_script.php to reside.
Access dummy.php from web browser. You should get something like
Grab the path from there and set it up in in the cron
Create a dummy.php
Code: Select all
<?php
echo __FILE__;
?>Access dummy.php from web browser. You should get something like
Code: Select all
/usr/someusername/whatever/blah/public_html/my_dir_1/dummy.php