If your Laravel queue processes jobs when you run php artisan queue:work manually but does nothing when scheduled through Hostinger, check whether the cron job is executing before changing Laravel's queue configuration. If even a simple cron test fails, the problem is likely in the hosting scheduler, command configuration, file paths or account restrictions rather than the Laravel listener itself.
Hostinger's hPanel also has specific requirements for commands containing shell-special characters. Moving those commands into a shell script is often the appropriate solution.
Understanding the problem
Consider a Laravel 12 application running on Hostinger shared hosting with PHP 8.2 and the database queue driver.
The environment file contains:
QUEUE_CONNECTION=databaseAfter a successful payment, Laravel dispatches a queued listener to send a confirmation email. The listener appears in the jobs database table but remains pending.
Running the following command through SSH processes the job successfully:
php artisan queue:work --stop-when-emptyHowever, scheduling the same command through hPanel does nothing.
This establishes that the queue can process the job when executed manually. It does not prove that cron is starting successfully or that the scheduled command uses the same PHP environment.
The first step is to isolate those two possibilities.
1. Verify that Hostinger cron is actually running
Do not begin by modifying event listeners, queue drivers or database tables.
Create a minimal shell script that writes the current time to a file.
For example, create this file outside your public web directory:
/home/ACCOUNT/cron-scripts/cron-test.shReplace ACCOUNT with your actual hosting account identifier.
Add the following content:
#!/bin/sh
LOG="/home/ACCOUNT/cron-test.log"
printf 'Cron executed at ' >> "$LOG"
/bin/date -u >> "$LOG" 2>&1The script uses absolute paths and records each successful execution.
Test it manually through SSH:
/bin/sh /home/ACCOUNT/cron-scripts/cron-test.shCheck whether cron-test.log contains a timestamp.
If it does, the script itself works. The next step is determining whether Hostinger's scheduler executes it automatically.
2. Configure the script through Hostinger hPanel
Open Hostinger's dashboard and navigate to the affected website's Cron Jobs section.
Create a Custom cron job rather than attempting to paste a complex shell command directly into the scheduler.
Use this command:
/bin/sh /home/ACCOUNT/cron-scripts/cron-test.shSelect an appropriate schedule. For initial testing, use every minute if your hosting plan permits it.
Save the cron job and wait for its scheduled execution.
Check cron-test.log again.
If no new timestamp appears, inspect the cron job's output in hPanel and confirm that the command points to the correct file.
Hostinger documents several possible causes of failed cron execution, including incorrect paths, unsupported command syntax and exceeded hosting resources.
Its scheduled task times are based on UTC, so account for the time difference when using a specific execution time.
See Hostinger's cron troubleshooting documentation.
3. Why shell-special characters matter
A commonly attempted Hostinger cron command looks like this:
cd /home/ACCOUNT/domains/example.com/public_html && /usr/bin/php artisan queue:work --stop-when-empty >> /home/ACCOUNT/queue.log 2>&1This contains several shell operators.
The double ampersand executes the second command only if the first succeeds. The double greater-than symbol appends output to a file. The final redirection combines standard error with standard output.
Hostinger's documentation explains that commands containing special characters should be placed inside a shell script and executed through a Custom cron job.
This is important because a command that works perfectly in an SSH terminal may not be accepted or interpreted correctly when entered directly into hPanel.
The official instructions are available in Hostinger's guide to cron jobs with special characters.
4. Create a Laravel queue worker script
Once the basic cron test works, create a separate script to process Laravel's queued jobs.
For example:
/home/ACCOUNT/cron-scripts/laravel-queue.shUse the following script, replacing the example paths with your actual hosting paths:
#!/bin/sh
set -eu
APP="/home/ACCOUNT/domains/example.com/public_html"
LOG="/home/ACCOUNT/laravel-queue.log"
LOCK="/home/ACCOUNT/laravel-queue.lock"
if ! command -v flock >/dev/null 2>&1; then
echo "flock is unavailable; worker not started" >> "$LOG"
exit 1
fi
cd "$APP"
if [ ! -f artisan ]; then
echo "Laravel artisan file not found" >> "$LOG"
exit 1
fi
(
flock -n 9 || exit 0
/usr/bin/php artisan queue:work database \
--stop-when-empty \
--max-time=50 \
--timeout=30 \
--tries=3
) 9>"$LOCK" >> "$LOG" 2>&1This example assumes that Hostinger provides the flock utility, that the account can create the lock and log files, and that /usr/bin/php points to a suitable PHP CLI installation.
Verify those requirements before using it.
The flock command prevents another scheduled invocation from starting a second worker while the previous one holds the lock. If flock is unavailable, use another supported locking mechanism rather than allowing unrestricted overlapping workers.
The --stop-when-empty option processes available jobs and exits when the queue is empty.
The --max-time option limits how long the worker continues processing jobs, although an individual running job may extend beyond that duration.
The --timeout option sets a worker timeout where the required PHP process-control functionality is available. Configure Laravel's database queue retry_after value to be longer than the worker timeout, with an appropriate safety margin.
The example values are suitable only for jobs that can safely finish within those limits. They must be adjusted for the actual workload and hosting restrictions.
5. Schedule the Laravel worker
After confirming that the script runs correctly through SSH, create another Custom cron job in Hostinger.
Use:
/bin/sh /home/ACCOUNT/cron-scripts/laravel-queue.shSet the schedule according to your hosting plan and the delay your application can tolerate.
Every-minute execution may be suitable for lightweight background tasks, but it is not equivalent to an continuously running worker. New jobs can wait until the next scheduled execution.
Check the queue log and verify that pending jobs are processed.
If jobs remain pending, inspect the actual command output before changing application code.
6. queue:work versus schedule:run
Laravel provides two commands that are often confused.
The queue:work command processes jobs from a configured queue connection.
php artisan queue:work database --stop-when-emptyThe schedule:run command executes tasks registered with Laravel's scheduler that are due at the current time.
php artisan schedule:runRunning schedule:run does not automatically process database queue jobs unless you have explicitly configured a scheduled task to start a worker or perform the relevant processing.
For the original problem, queue:work is the correct command because the application already has jobs waiting in its database queue.
See the Laravel 12 queue documentation for the available worker options.
7. Prevent overlapping workers and duplicate processing
Starting another worker every minute can cause unnecessary resource consumption if earlier workers are still running.
A locking mechanism prevents overlapping executions of the same scheduled script. However, it does not eliminate every possibility of a job being retried or executed more than once.
Laravel jobs should be designed to tolerate retries safely, especially when processing payment events, generating invoices or sending notifications.
For example, a payment confirmation listener should check whether the intended confirmation has already been recorded before performing an irreversible action again.
Also monitor failed jobs and ensure that long-running tasks cannot exceed the hosting account's resource limits.
8. When shared hosting is the wrong solution
Running a short-lived queue worker through cron can work for small applications with modest background-processing requirements.
However, applications requiring reliable near-real-time payment processing, large queues or sustained background activity are better suited to infrastructure that supports supervised workers.
Laravel recommends using a process monitor such as Supervisor to maintain long-running queue workers in production.
A VPS or suitable managed application hosting environment provides more control over worker restarts, concurrency, timeouts and resource allocation.
Do not expose an unauthenticated HTTP endpoint that runs Artisan commands as a workaround for unavailable cron functionality. An externally accessible command trigger creates additional security and reliability risks, particularly for payment-related workloads.
Final troubleshooting checklist
Before changing Laravel's queue configuration, verify that the cron test script executes through hPanel, the PHP CLI path is correct, the Laravel application directory exists and the hosting account has sufficient permissions.
Next, confirm that the worker uses the intended database connection, that queued jobs are not delayed, and that application logs contain no processing errors.
If the simple timestamp script never runs, concentrate on Hostinger's cron configuration and hosting limits. If the timestamp script works but Laravel fails, investigate the PHP CLI environment, application configuration and queue worker output.
The underlying principle is to test the scheduler independently before troubleshooting the application. Once cron execution is confirmed, Laravel queue problems become much easier to isolate.
