Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ivymaster's avatar

How to create a crone job?

I am using a Hostinger's single shared hosting plan. I want to create a crone job for my laravel app. But every time I only get the error

fork failed: Resource temporarily unavailable

I created a customer crone job command

/usr/bin/php /home/u959931697/domains/checknrecheck.com/public_html/wp-cron.sh	

And an .sh file in my public folder, with the content of:

#!/bin/sh
/usr/bin/php /home/u959931697/domains/checknrecheck.com/public_html/inspireme_storage && php artisan schedule:run >> /dev/null 2>

I tried almost every thing online, but with no success. Can someone share a functioning crone job for Laravel, or suggest some solutions? Thx in advance

0 likes
4 replies
Snapey's avatar

a) why is your project in the public_html folder ? This is insecure

b) why are you running a cron job to fire a shell command? just run artisan direct from your cron job

cd /home/u959931697/domains/checknrecheck.com/public_html && /usr/bin/php artisan schedule:run >> /dev/null 2>&1

adjust the above to the root of your laravel project

ivymaster's avatar

@Snapey I know it is insecure but I am was just trying to create my first crone job haha. When i paste your command, or any other with some special characters, i get the an error

Some characters are not allowed for cron job command

Then I looked online for a solution, and used the shell command.

Snapey's avatar

This is copied directly from cpanel on a hostinger site

/usr/local/bin/php /home/bxxxxxx286/Live/artisan schedule:run >> /dev/null 2>&1

Just with the client name xxxxxx out

In this case, the deployed project is in Live folder, and public_html has been deleted and turned into a symlink to the laravel public folder

lrwxrwxrwx 1 bxxxxxx286 bxxxxxx286  26 Jul  6 16:47 public_html -> /home/bxxxxxx286/Live/public

Please or to participate in this conversation.