WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline eSPee

  • Newbie
  • *
  • Posts: 13
How to run a PHP-script from crontab (RPI armv6)
« on: October 30, 2023, 12: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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1654
Re: How to run a PHP-script from crontab (RPI armv6)
« Reply #1 on: October 31, 2023, 02: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.
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline eSPee

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

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

Best regards, eSPee