Some folks need to create web cronjobs website for scheduling tasks. Typically, there are 3 simple methods for setting up a cronjob for scheduling tasks.
- Native Cronjobs.
You can find these option on your cPanel. For more detailed post, you may want to check out our post how to set up cronjob using cPanel.
- Using third-party websites.
At this time, there are several websites available for scheduling tasks. One of them is cron-job.org. We mainly use this website. Because it is free and you can set cronjob interval as 1 minute. Need to know how to set up cronjob on cron-job.org? You may want to check out how to set up cronjob using cron-job.org.
- By creating own website.
By creating your own website, you can run unlimited cronjobs free and with custom timing. Last time, we have show you creating cron website using the easy cronjob web handler script. If you missed that post, check out the step bu step guide to create cronjob website using easy cronjob web handler.
In this post, we are going to show you that how can you create web cronjobs website without getting an error.
How To Create Web Cronjobs Website?
For this, you only need 3 things.
- Web Hosting.
- Web Cronjobs.
Buy Domain Name
The domain is where folks type the address of your website. GoDaddy and Namecheap are famous domain registrars. For registering our domain names, we use GoDaddy. You can use GoDaddy .com domain trick or GoDaddy .in domain trick for registering your domain.
We will not recommend you using free domains.
For storing the website files online, you need a space. That’s what hosting means. You can store your files on the web hosting and serve files to your visitors.
Creating a Website
After purchasing your domain name, you need to log in to cPanel. Open the file manager and go to the folder that you need to upload the script. If you are planning to upload the script on the root, you need to upload it to the public_html folder.
In my case, I would like to upload it on a subfolder.
Upload Web Cronjobs script there.
The script is in ZIP format. You need to extract it.
After extracting, you need to delete the ZIP file.
The script needs some extension for working. For you need to execute the requirements.php file on your browser. Means, if you have installed the script on your root, type like www.example.com/requirements.php
If you didn’t pass all those, you can contact your hosting provider. They will probably help you to do it. Now, make sure that the uploads, assets, protected/runtime directories have 777 directory permission.
Create a database and assign a user to it. You can see a SQL file on the script.
After that, you need to run the webcron SQL file to the database. Go to PhpMyAdmin.
Choose the cronjob’s DB from the left side.
Go to the import section there.
Choose the SQL file from your computer and run the file.
If everything okay, you will get success from there.
Go to protected/config/db.php file.
You need to edit the file for adding MySQL database credentials.
For editing the mail settings, edit the mailer file.
Go to your website front end and log in to the system. The default username and password are the admin, admin.
You will be redirected to the dashboard soon.
You are now successfully hosted the site. For running cronjobs, you need to set a native cronjob.
Setting Up Native CronJob.
* * * * * /usr/bin/php /path/to/web/root/protected/yii exec >/dev/null 2>&1
****** means you need to run the cronjob every minute. So, set 1 minute as cron interval.
Find the path to the script. Most web hosting will show you the exact path to your script.
Enter the command and save it.
That’s it. Add cronjobs on your website and you are good to go!
You have now successfully made the cronjob website. We hope you found this tutorial helpful and enjoyed the read. If you did, please consider sharing this post with your friends.
Why You Need To Create Web Cronjobs Website?
The answer is simple. For more transparency. Using your own cronjob website will give you more freedom on the website. Also, you will be able to sell your services and make money.