PHP Cron Job

software development

#1

Guys-

I have a PHP file (xmlgen.php) in a folder that I’m trying to execute using a cron job.

My cron job looks like this:

cd /home/stlgk/stlgatekeepers/feeds; php xmlgen.php

The emails I’m getting say “sh: php: command not found”

What am I doing wrong? This command works when I SSH in.

Thanks in advance for all your help!


#2

A cron job’s shell environment is often different from a login shell. Possibly your login profile changes the PATH, etc. You should be able to run php using an absolute path to php:

/usr/local/php5/bin/php xmlgen.php


#3

yup, that was it… i needed an absolute path.

Thanks for your help!