ここでいくつかの問題が発生しています。最も重要なのは、SSH アクセスを確立することです (「コンソール アクセス」と呼んでいます)。これがないと、cron ジョブをセットアップできません。
cron ジョブに関しては、次の手順に従います。
1) おそらくホームディレクトリに crontab ファイルをセットアップします。開始するためのサンプル ファイルを次に示します。
#This file is: /home/<your-user-name>/mycronfile.cron
#Use "crontab mycronfile.cron" to reinstall this file
#Use "crontab -l" to list the contents of the current crontab
#Use man 5 crontab for info
#Format is: minute hour dayofmonth month dayofweek
# * * * * * *
# | | | | | |
# | | | | | +-- Year (range: 1900-3000)
# | | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
# | | | +------ Month of the Year (range: 1-12)
# | | +-------- Day of the Month (range: 1-31)
# | +---------- Hour (range: 0-23)
# +------------ Minute (range: 0-59)
# , and - can be used as in 0,15,30,45 or 1-5
# run my script every WEEKDAY at 3pm
0 15 * * 1-5 php -f /Library/Developer/myscript.php
# note that it's okay to leave out Year since I'm not using it
2) 上記の cron の例に従って、このファイルをホーム ディレクトリからインストールします。
crontab mycronfile.cron
3) 次のように入力して、インストールされていることを確認します。
crontab -l
最後に、PHP スクリプトでは $_SERVER グローバル変数を使用できないことに注意してください。これは、CLI モードがこれらのグローバル変数を受け入れないためです。すべてのパスは絶対パスでなければなりません。