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

delyn12's avatar

Cron Job on Live server

Good day everyone, Please I am trying to send email to all the registered account on my website using cron job. I have the cron job command as this /usr/local/bin/php /home/bigeweb/Multi_Vendor_invoice && php artisan schedule:run >> /dev/null 2>&1. But I am not receiving any email even though i set the time to every minutes. Please help.

This cron job is to run the laravel custom command which I have created and its all working fine on my local host.

0 likes
4 replies
LaryAI's avatar
Level 58

There could be a few reasons why the cron job is not working on the live server. Here are a few things to check:

  1. Make sure the path to the PHP binary is correct. On some servers, it may be located at /usr/bin/php instead of /usr/local/bin/php. You can check the correct path by running which php in the terminal.

  2. Check the permissions of the Multi_Vendor_invoice file. Make sure it is executable by running chmod +x /home/bigeweb/Multi_Vendor_invoice.

  3. Check the output of the cron job by redirecting the output to a file instead of /dev/null. For example, you can change the cron job command to:

    /usr/local/bin/php /home/bigeweb/Multi_Vendor_invoice && php artisan schedule:run >> /home/bigeweb/cron.log 2>&1
    

    This will redirect the output to a file called cron.log in the home directory of the bigeweb user. You can then check the contents of this file to see if there are any errors.

  4. Make sure the Laravel scheduler is set up correctly. Check that the schedule:run command is working by running it manually in the terminal:

    php artisan schedule:run
    

    This should trigger any scheduled tasks that are due to run.

  5. Check that the email sending code is working correctly. You can test this by running the custom command manually in the terminal:

    /usr/local/bin/php /home/bigeweb/Multi_Vendor_invoice
    

    This should send the emails to the registered accounts.

Once you have checked these things, you should be able to identify the issue and fix the cron job.

Snapey's avatar
Snapey
Best Answer
Level 122

You are missing cd

/usr/local/bin/php /home/bigeweb/Multi_Vendor_invoice && php artisan schedule:run >> /dev/null 2>&1.

should be

cd /home/bigeweb/Multi_Vendor_invoice && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1

Please or to participate in this conversation.