I have a web server running on AWS which is connected to a mysql database. The database has an event that run once a day. I need to run a php script on the same schedule which checks the DB and then sends Push Notifications. I don't believe I can do this from within the DB so it needs to be done on the web server. I just don't know how to do this type of thing on AWS.
I have never run a cron job but that seems like what I might want, but I don't know how this is accomplished on AWS and can it fire a php script?
You have several issues going on here, the most important is getting your SSH access established (as you call it, "console access"). Without it, you won't be able to get your cron jobs setup.
As for cron jobs, you will want to follow these steps:
1) Setup a crontab file, probably in your home directory. Here's a sample file to get you started:
#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) Install this file as directed in the cron example above, from your home directory:
crontab mycronfile.cron
3) Confirm it's installed by typing:
crontab -l
A last note is that in your PHP scripts, you cannot use $_SERVER global variables because CLI mode does not honor those globals. All your paths must be absolute.