Cron is not running in openhost - php

I set new cron in my openhost admin panel using
curl http://www.example.net.nz/sendmail.php but its not working.
and my cron setting is below.
Please suggest me some idea what can i do so my cron is run properly.
I also read this but there is not any description regarding cron command openhost support link.
Above command is properly in my WHM server unfortunately it not working in Openhost server.

You should use /usr/bin/php and path to file on server like /var/www/project/a.php

Related

How to run php script on cron job in cpanel

I schedule a new job on cronjob. But it's not working. Is there any way to run cronjob in cpanel using commands.
There is a bunch of way to running script with CRON. I do use this way on my web application most of the time when I need to use CRON.
The first step is to choose a setting. The setting means when you want to run this script.
and after then simply just use CURL with Cron to get this work properly like this: curl http://example.com/script.php on command box and click on the add button and whola! You have successfully added your first CRON Task.
You may have a look at this picture below to get it properly
Go to CRON JOB option on your cpanle menus
Set url like this and set time according to your functionality
php /home/username/public_html/filename.php
Run it in putty
/usr/bin/php /var/www/html/project_name/artisan schedule:run 1>> /dev/null 2>&1 this is for laravel project
you can simply use like this - /usr/local/bin/ea-php74 /home/username/domainname.com/script_path/yourfile.php
replace username to your cpanel username, domain name to your domain name, script path where you want to run it, then replace the main file for corn job in yourfile.php

Cronjobs Plesk 10.2.0 Not working

Currently I am trying to get a cronjob working in Parallels Plesk Panel 10.2.0.
The script I want to run is on a subdomain.
I've tried a lot of options in the command line, but nothing is working.
Tried:
/usr/bin/php /home/httpd/vhosts/subdomain.domain.com/httpdocs/file.php
/usr/bin/wget -O - -q http://www.subdomain.domain.com/file.php
/usr/curl http://subdomain.domain.com/controller/action
/var/www/vhosts/subdomain.domain.com/httpdocs/file.php
php /var/www/vhosts/subdomain.domain.com/httpdocs/file.php
None of the above work. Also in the schedule task settings under Send notification messages from scheduler to e-mail address I filled in my email address but I won't get any emails.
Please help me, Thanks!
EDIT
My setting Access to the server over SSH are set to Forbidden I don't know if this can be a reason
If you are using Parallels, the following SHH command is required to allow full access permissions as cron tasks run using a restricted access rights
/usr/local/psa/bin/server_pref -u -crontab-secure-shell "/bin/sh"
And to revert the access permissions
/usr/local/psa/bin/server_pref -u -crontab-secure-shell ""
I have followed this tutorial which given me positive results for setting up a cron job in parallels plesk.
The sentence which worked for me is:
/usr/bin/php -f /var/www/vhosts/bonusgo.com/httpdocs/cron.php
Dont forget to set the email address for cron jobs messages/alerts, in your hosting admin panel
Check the following url: Set up a Magento cron job in plesk

Godaddy cron job setup for running php script

can you help me setup cron job on godaddy webhosting? I have php file that i need to run, it is located in cron subdirectory (so address is http://test.com/cron/file.php).
What do i need to write in command input field, so this file is runned?
NOTE: GoDaddy has been migrating all hosting packages over to cPanel. The itemized instructions below are for the older GoDaddy interface. The command is still the same.
At the time of this writing, on GoDaddy shared hosting, i could NOT use the following commands: ping, curl, nc, lynx
but i COULD use: wget
I successfully created a cron job using wget to load a PHP file containing a call to mail().
log into your GoDaddy account
click to expand the "Web Hosting" section and find the server in question
click the "Manage" button (it used to be labeled "Launch")
on the "Hosting Details" page in "Tools" section, click "Cron Job Manager" button
on the "Cron Job Manager" page, click "Create Cron Job" button
enter the title you want and select the frequency (1 hour is the most frequent allowed EDIT: GoDaddy has added 15-minute increments to the frequency choices.)
enter the command below (with your info):
wget http://YOUR_DOMAIN/YOUR_PATH/YOUR_PHP_FILE.php > /dev/null 2>&1
edit: as noted by Leandro, this is the method to make a cron job call a remote or local resource -- consult GoDaddy documentation if you want to call a resource locally only (which is also more secure if you're running more sensitive jobs)
in "YOUR_PHP_FILE.php" code all the actions you want to be performed and include a call to mail() (or whichever mail method you may want to use assuming you have configured that properly).
By using mail() the SMTP relay server will already be set properly in the "php.ini" file to: relay-hosting.secureserver.net -- which you can confirm using phpinfo().
php_path -q file_name_with_absolute_path
/usr/bin/php -q /home/[user name]/public_html/test.php
1: How to know your php_path?
echo exec('whereis php');
2: How to know absolute path of your file?
echo dirname(__FILE__);
Cron Setup for GoDaddy Shared Hosting Accounts using Cpanel.
*-->>Cron jobs run on GoDaddy's time zone in Arizona. Go Daddy doesn't publish this anywhere.
Example:
Run cron everyday at 1305 (1:05pm) pacific standard time.
5 14 * * * /usr/local/bin/php -q /home/username/public_html/scriptname.php
Your cron job command should look something like the following (unless your directory structure is different of course):
/web/cgi-bin/php5 "$HOME/html/sendy/scheduled.php" > /dev/null 2>&1
Regrads,
shahana
If you are using Godaddy this should solve your issue.
* * * * * /usr/local/bin/php /home/path/to/your/file.php > /dev/null
In Godaddy Linux hosting. I used this command to run cron job.
/usr/bin/php public_html/now your path
Use, for example CURL or wget or lynx.
lynx -s http://link.to/script.php
/usr/local/bin/php -q /home/[user name]/[path to the file]
Reference
You can setup cron jobs through the Hosting Control Center. Check out GoDaddy's official page here: https://www.godaddy.com/help/create-cron-jobs-3548 for a how-to on setting it up.
If you want to run a cron job in Godaddy. You can find following command, it will surely help you.
php -f /home/[user name]/[path to the file]

Run PHP cronjob on hosting system

I wish to run a lengthy PHP script on a hosted Linux system (for example Godaddy or OVH). The script is supposed to be able to run for 1 or 2 hours. I suppose that would be a cronjob.
I have tried to make a Linux command call my PHP with following:
print `echo /usr/local/bin/php -q myScript.php | at now`;
But this does not return any feedback, and the script is not processed.
Using 'which PHP' I could check that the path to PHP is correct.
Also, other simple commands like ls -l give me proper output.
I am not sure how to further troubleshoot this, or if it is even possible.
How would you recommend to proceed to run my PHP script?
Update:
I have tried putting the whole path to the script and it made no difference.
Since I do not know how to edit cron on the hosting account, I am calling my PHP script by calling another PHP file. I have:
triggerScript.php:
<?php
print `/usr/local/bin/php /path/to/myScript.php`;
?>
and myScript.php:
<?php
print `ls -l`;
?>
Now I run triggerScript.php on my browser, and the page seem to load for a while but I get a browser error "Internet Explorer cannot display the webpage".
Did you say GoDaddy?
Check this out:
http://help.godaddy.com/topic/67/article/3547?locale=en
All the linux shared hosting I use/used has option to setup cron from control panel. You do not have to setup by running a command from php...
Godaddy supports cron, even with the lowest priced account. I use this features on some of my sites hosted on Godaddy.
You probably don't have shell access and cannot get real cron jobs.
Use one of the free or commercial "web cron" providers that regularly call one of your web php scripts. Combine that with a set_time_limit call in your php script so it does not get killed for runnning too long.

Cannot execute crontab command from a php script...from shared host

I'm running an application where I need to execute the cron job, once a form is submitted,contains more than 1 lac records in a loop(its on-demand execution of cron job and deletes the job once finished).
I'm using php, I tried to configure the job through cpanel as a test and it works...the command was.."/ramdisk/bin/php5 -f /home/user/public_html/domain/cron.php -q", it worked fine.
But when I tried to run the same job with the exec() of php, like I wrote this whole command to a file (I do not know where the original crontab file is located otherwise could have written to it, please suggest a way to find its location) and ran that file like "exec("crontab /home/user/cron/Feed_cron"); ", in this cron is not working...
I doubted whether the crontab command will not work for particular user.. I tried it from the "root" user....which is the root user....tried the command via SSH or Putty and the response was "command not found". Please find a solution for this, also please give me an idea whether my concept works fine...
please suggest a way to find its location
Try
whereis crontab

Categories