Help on cron Jobs for Hostinger server

“newbie in cron jobs here”
hello everyone
we use hostinger as our hosting server and we successfully installed invoice ninja as integrated system
but there is error warning that we have to use cron job error 403
the cron jobs setup in hostinger is abit different than other topics i found and when using the same commands it says … some characters cannot be used in command line and its the “>” symbol
i tried 5 commands from topics here and all failed

here a screen from cron jobs setup page

thanks in advance

Hi,

The main part is to run artisan schedule:run every minute

@hillel would this cron work?

/usr/bin/php /home/USER/domains/SITE.com/public_html/invoice && php -d register_argc_argv=On artisan schedule:run 

do I need to change QUEUE_CONNECTION=sync in .env to Database?

@Insanebarneykid did you figure it out?

Hello, also cant find how to solve it with Hostinger

I’m facing the same problems after trying multiple variants.

no still didnt figure it out

1 Like

Ok, my way to make it work:

  1. Check your PHP version

I logged in using SSH and tried /usr/bin/php artisan to see if there were any problems.
I was running the wrong PHP version, and I was unable to change it (even though I changed the version in your admin under Advanced/PHP Configuration
Even changing the .htaccess doesn’t have any effect.

Special for Hostinger:

The support told me that the PHP version is based on the main domain. So I changed that.

Running the same command gave me “INFO No scheduled commands are ready to run”.

So some progress here.

If you are creating a cronjob with special characters, you need to follow this tutorial:

  1. Create a separate file to run the cron job

I created a script.sh in public_html/scripts with the following content

#!/bin/sh
cd /home/u12345/domains/invoiceninja.mydomain.com/public_html && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

u12345 = your user
invoiceninja.mydomain.com = your domain

See Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja

  1. Create the cron

type: Custom
/bin/sh /home/u12345/domains/invoiceninja.mydomain.com/public_html/scripts/script.sh.

reminder
u12345 = your user
invoiceninja.mydomain.com = your domain

  1. Check your application
1 Like

thank you simon this reply i created folder named scripts with file contains
#!/bin/sh
cd /home/user/domains/domain.net/public_html && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

i created cron job with
/bin/sh/home//domains//public_html/scripts/script.sh every once an hour
yet nothing happened.

is there something wrong with what i did?

The cron should be run every minute.

actually i did as shown here

and here is script.sh
#!/bin/sh
cd /home/my account is here/domains/my domain here /public_html && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

i dont know if this is would make a different but the url for ninja on my host followed by /public/index.php