Set locale for php
php is left adrift from the system locale settings so we need to be set it explicitly for use system-wide. php is assumed already installed.
2021-11-01 Raspbian buster-bullseye, Ubuntu 20.04-22.04, macOS 15.5
This example uses:
- php version
- 7.4, sometimes commands use 74.
linuxgraham:~ sudo vi /etc/php/7.4/*/php.ini graham:~ php -r 'echo setlocale(0, "0")."\n";' en_AU.UTF-8 graham:~ php -r 'echo date_default_timezone_get()."\n";' Australia/Melbourne
- Verify that the settings have taken effect.
If php-fpm was one of the
php.ini files updated:
From macOS 15.x
monterey, php is no longer pre-installed.
We assume use of MacPorts
to have already installed php 7.4.
- Update settings as for linux above.
- Similarly, test settings as for linux above.
If php-fpm is installed:graham:~ sudo launchctl stop org.macports.php74-fpm graham:~ ps -ef | grep 'php.*-fpm' | grep -v grep 0 11241 1 0 7:20pm ?? 0:00.01 /opt/local/bin/daemondo --label=php74-fpm --start-cmd /opt/local/sbin/php-fpm74 ; --pid=exec
- The php-fpm service is restarted automatically; do not restart it yourself.
Verify that the start time on the
php74-fpmprocess above corresponds to when you stopped the service (and allowed it to restart).