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

depalmo's avatar

Scheduler for custom PHP file not working

I'm trying yo set up a Scheduler for a custom PHP project deployed onto Forge (and DigitalOcean as host provider), but it's not working. No errors are thrown, no logs are filled and the code does not execute. My set up is following:

  • I have a custom coded PHP project which was deployed onto Forge with User Isolation checked (and set as "app")
  • this project has a cron.filename.php file that is working well if called externally (through wget or some other service)
  • Scheduler Job is set as:
    • command: php8.1 /home/app/app.example.com/cron.filename.php
    • User: app
    • Frequency: 0,30 * * * *

I also tried these combinations:

  • command: php /home/app/app.example.com/cron.filename.php
  • command: cd /home/app/app.example.com && php cron.filename.php
  • User: forge

None of above works. Any idea why? Also, how could I su into app, if I do not know the password for it? Wanted to see the output it generates for that user, if there are any errors. I can't execute the code as forge (or any other user), since the cron job need write access to files.

0 likes
1 reply
LaryAI's avatar
Level 58

There are a few things that could be causing the issue:

  1. Make sure that the cron job is actually running. You can check this by running the command sudo grep CRON /var/log/syslog on your server. This will show you a list of all the cron jobs that have run recently.

  2. Make sure that the path to your PHP binary is correct. You can check this by running the command which php on your server. This will show you the path to the PHP binary that is being used.

  3. Make sure that the user that the cron job is running as has permission to execute the PHP file. You can check this by running the command ls -l /home/app/app.example.com/cron.filename.php on your server. This will show you the permissions for the file.

  4. Try running the command as the app user. You can do this by running the command sudo -u app php /home/app/app.example.com/cron.filename.php. This will run the command as the app user and should give you any errors that are being generated.

Here is an example of what the cron job command should look like:

* * * * * php /home/app/app.example.com/cron.filename.php >> /var/log/cron.log 2>&1

This will run the command every minute and log any output to the /var/log/cron.log file.

Please or to participate in this conversation.