how to run PHP script via CLI at startup on a RHEL machine?
Results 1 to 2 of 2

Thread: how to run PHP script via CLI at startup on a RHEL machine?

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,874

    how to run PHP script via CLI at startup on a RHEL machine?

    I've got a PHP script I'd like to launch when my RHEL server boots up.

    Should I just add this line to /etc/rc.d/rc.local?
    Code:
    php -q /path/to/my/script.php > /path/to/output.txt
    Or is there some better way?
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  2. #2
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,715
    I'm sure you've figured this out by now, one way or the other. For the Next Google User(tm):

    There's several ways to skin that cat, and rc.local is a good one.

    Perhaps even less known is the "@reboot" target in your crontab(5):
    Code:
    @reboot                        /usr/bin/php -q /path/to/somescript.php
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •