Does PHP not honor parameters in the shebang line if passed?
How do you set a custom php.ini file when creating a CLI script?
[code]#!/usr/bin/php -c /etc/customphp56/php.ini
complains about date.timezone not being set. But it is set in /etc/customphp56/php.ini
There seems to be a problem when trying to pass arguments to PHP via the shebang. You’d be better off setting the timezone in your main php.ini file.
That’s not really ideal. There are other changes I’d like to make to this customize php.ini file.
In the interim, I’ve changed to calling the script by passing the php CLI binary directly
/usr/bin/php -c /etc/customphp56/php.ini /path/to/file.php
That seems to work.
Just would prefer this to work through the shebang line. Not sure why it’s not. I pulled out many hairs from my head this afternoon trying to figure this out.
Yes, you have to use the command line to do it. There are a couple of ways of getting around this problem:
- Set the timezone in the script: http://php.net/manual/en/function.date-default-timezone-set.php
- Have a php script run a php script
exec('/usr/bin/php -c /etc/customphp56/php.ini two.php', $output);
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.