i need clean mysql database every day and i want to know if you can tell me how to do this from the shell. i got the dedicated server from you guys at www.webune.com but i still need to know if you can help me with this because its making my files go big and im running out of space
thanks
How To Run PHP Scripts With Crontab Make Php Files Executable
How To Run PHP Scripts With Crontab Make Php Files Executable
How To Run PHP Scripts With Crontab Make Php Files Executable
Post Description:
Post Tags: how, to, run, php, scripts, with, crontab, make, php, files, executable
This Post Has Been Viewed 1465 Times Since Tue Jan 08, 2008 11:50 am Posted By unix admin with 3 replies
Next Post »» linux shell command to run php files with lynx crontabs
Post Description:
Post Tags: how, to, run, php, scripts, with, crontab, make, php, files, executable
This Post Has Been Viewed 1465 Times Since Tue Jan 08, 2008 11:50 am Posted By unix admin with 3 replies
Next Post »» linux shell command to run php files with lynx crontabs
| How To Run PHP Scripts With Crontab Make Php Files Executable |
Leave Your Comments [ dejar commentarios ]
Comments and replies About How To Run PHP Scripts With Crontab Make Php Files Executable
:: 1 :: #35432 - Reply By linux help On Tue Jan 08, 2008 11:54 am
well, first you need to find out if how your apache was compile, then you do this:
[ click here to find if apache was installed with CGI or APACHE module ]
Compiled CGI
If the answer to the question above is "CGI" then you need to add a line to your PHP script. It has to be the first line of your script and must contain your server's PHP executable location:
#!/usr/local/bin/php -q
That looks a lot like PERL now, doesn't it? After that let's add the necessary command to our crontab. Edit /etc/crontab and add the following line:
* * * * * php /path/to/your/cron.php
Execute the following from the command line:
Shell> crontab crontab
Be sure your "script.php" has the necessary permissions to be executable ("chmod 755 script.php"). Now you are all set!
Apache module
If your PHP is installed using the Apache module, the approach is a little different. First, you need access to Lynx (Lynx Browser for more information). Lynx is a small web browser, generally available on Unix and Linux. Running your PHP script will not require you to add any additional lines. You simply have to edit your /etc/crontab file and add the following line:
* * * * * lynx -dump http://www.somedomain.com/cron.php
Please note that in general, you have to specify the entire URL (with "http://" and so on). But depending on your Lynx's configuration, the URL might be relative; I suggest always using the absolute reference as in my example above - it always works. Again execute the following from the command line:
Shell> crontab crontab
That all it takes to get a cron job setup using PHP. Hope you have learned something new and will use it to save overhead time on the server and on the developer.
[ click here to find if apache was installed with CGI or APACHE module ]
Compiled CGI
If the answer to the question above is "CGI" then you need to add a line to your PHP script. It has to be the first line of your script and must contain your server's PHP executable location:
#!/usr/local/bin/php -q
That looks a lot like PERL now, doesn't it? After that let's add the necessary command to our crontab. Edit /etc/crontab and add the following line:
* * * * * php /path/to/your/cron.php
Execute the following from the command line:
Shell> crontab crontab
Be sure your "script.php" has the necessary permissions to be executable ("chmod 755 script.php"). Now you are all set!
Apache module
If your PHP is installed using the Apache module, the approach is a little different. First, you need access to Lynx (Lynx Browser for more information). Lynx is a small web browser, generally available on Unix and Linux. Running your PHP script will not require you to add any additional lines. You simply have to edit your /etc/crontab file and add the following line:
* * * * * lynx -dump http://www.somedomain.com/cron.php
Please note that in general, you have to specify the entire URL (with "http://" and so on). But depending on your Lynx's configuration, the URL might be relative; I suggest always using the absolute reference as in my example above - it always works. Again execute the following from the command line:
Shell> crontab crontab
That all it takes to get a cron job setup using PHP. Hope you have learned something new and will use it to save overhead time on the server and on the developer.
:: 2 :: #36698 - Reply By [EviL] On Wed Jan 16, 2008 3:00 pm
just an extra command opinion:
* * * * * wget somedomain /cron.php
or
* * * * * wget -o /dev/null somedomain /cron.php
will also work :)
* * * * * wget somedomain /cron.php
or
* * * * * wget -o /dev/null somedomain /cron.php
will also work :)
:: 3 :: #36726 - Reply By hostman On Wed Jan 16, 2008 5:06 pm
oooof.. thanks for that tip

