You're probably getting a different set of environment variables when you execute your command via cron, versus the command line. You might need to write a wrapper script that sets the environment up the way you want it before running your PHP command.