Can't include files in command line php

I’m migrating to a new server (from php4 to php 5) and I’m finding that scripts run from command line (or cron) can’t access files in the include path.
They run fine if I access the php script via a browser, but when I try to run via command line eg
php /path_to_script/scriptname.php

I get the warning
Warning: include(my_include.php): failed to open stream: Operation not permitted in /path_to_script/scriptname.php

Any ideas? Is this a quirk of php 5, some other config of the new server?

It’s probably an include_path problem. You may need to include the current working directory in the include_path.

Cheers. But the current directory is already included in the include path:
include_path = ‘.:/where_my_includes_are’

I ran a script, via command line, which outputs the ini settings available to the script, and it does have the right include path, but for some reason it is being denied.

Sounds like safe_mode. Try turning it off in php.ini (There is a separate one for web and cli)

Safe mode is off. I think we’ve fixed it though.
I’d set a directory in open_basedir. We removed it. All ok now. Strange stuff.
Thanks for the replies though.

Ah … For some reason I collated open_basedir with safe_mode.

From the php.ini:

This directive is NOT affected by whether Safe Mode is turned On or Off.