WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to run a PHP-script from crontab (RPI armv6)  (Read 1109 times)

Offline eSPee

  • Newbie
  • *
  • Posts: 23
How to run a PHP-script from crontab (RPI armv6)
« on: October 30, 2023, 03:17:24 PM »
Hi all,

On a zero w pi I am running:
- Tinycorelinux 9.x (armv6)
- apache2.4-mod-php5

If possible i would like to run a php script executed by crontab. As far as i know this requires php-cli.tcz. Can anybody confirm if this is the right assumption?

I could not find a php-cli package on the 9.x armv6 repository. Can anybody help me get this package, if this is required? Your help is much appreciated.

Best regards, eSPee

Offline CentralWare

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 776
Re: How to run a PHP-script from crontab (RPI armv6)
« Reply #1 on: October 31, 2023, 05:57:26 AM »
TinyCore 9.x goes back a bit.
IF MEMORY SERVES...  PHP5 and PHP7 were both available for the ARM back then.  Install one or the other.
You DO NOT need the apache PHP support installed if you're not going to use a web server.

Once done, go to the command line and enter:
Code: [Select]
php -v
If successful, which it should be, it should show you the version information regarding the PHP version you installed.
IF SO, let's say you had a script you wanted to run manually in the shell (as CRON would be doing)
Code: [Select]
php /place/to/MyPHPfile.php
If THAT is successful (which again, it should be) you then take the same line and enter it in as a cron task/tab and you're done.

Offline eSPee

  • Newbie
  • *
  • Posts: 23
Re: How to run a PHP-script from crontab (RPI armv6)
« Reply #2 on: November 01, 2023, 04:06:19 AM »
Hi CentralWare,

Thank you for your thorough reply, this helps a lot!

Best regards, eSPee