Issues while setting timezone - question about locales

Description

I’ve installed ApisCP and after installation i tried to change the Timezone and Locale from the Admin Menu (so for the admin profile) and its reporting fatal(): `common_set_timezone': crash or other nasty error detected. When trying to change the system.timezone over Configuration Tab to Europe/Berlin i get the error Postback failed!!!. When i try to change the system.timezone via CLI i get the following error:

[root@master ~]# cpcmd scope:set system.timezone Europe/Berlin
WARNING: dba_open(/etc/php.ini): Failed to open stream: No such file or directory 
[/usr/local/apnscp/lib/Opcenter/Map.php:56]

         0. dba_open("/etc/php.ini", "wd", "inifile", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:56]
         1. Opcenter\Map->__construct("/etc/php.ini", "wd", "inifile", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:268]
         2. Opcenter\Map::load("/etc/php.ini", "wd", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:128]
         3. Opcenter\Map::write("/etc/php.ini")
            [/usr/local/apnscp/lib/Opcenter/Admin/Settings/System/Timezone.php:46]
         4. Opcenter\Admin\Settings\System\Timezone->set("Europe/Berlin")
            [/usr/local/apnscp/lib/modules/scope.php:68]
         5. Scope_Module->set("system.timezone", "Europe/Berlin")
            [/usr/local/apnscp/lib/Module/Skeleton/Standard.php:145]
         6. Module\Skeleton\Standard->_invoke("set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/apnscpfunction.php:992]
         7. apnscpFunctionInterceptor->call("scope_set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/CLI/cmd.php:62]
         8. CLI\__call("scope_set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/CLI/cmd.php:581]
         9. CLI\main()
            [/usr/local/apnscp/bin/cmd:7]
WARNING: dba_open(/etc/php.ini): Failed to open stream: No such file or directory 
[/usr/local/apnscp/lib/Opcenter/Map.php:56]

         0. dba_open("/etc/php.ini", "wd", "inifile", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:56]
         1. Opcenter\Map->__construct("/etc/php.ini", "wd", "inifile", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:268]
         2. Opcenter\Map::load("/etc/php.ini", "wd", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:128]
         3. Opcenter\Map::write("/etc/php.ini")
            [/usr/local/apnscp/lib/Opcenter/Admin/Settings/System/Timezone.php:46]
         4. Opcenter\Admin\Settings\System\Timezone->set("Europe/Berlin")
            [/usr/local/apnscp/lib/modules/scope.php:68]
         5. Scope_Module->set("system.timezone", "Europe/Berlin")
            [/usr/local/apnscp/lib/Module/Skeleton/Standard.php:145]
         6. Module\Skeleton\Standard->_invoke("set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/apnscpfunction.php:992]
         7. apnscpFunctionInterceptor->call("scope_set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/CLI/cmd.php:62]
         8. CLI\__call("scope_set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/CLI/cmd.php:581]
         9. CLI\main()
            [/usr/local/apnscp/bin/cmd:7]
FATAL  : fatal(): failed to open db `/etc/php.ini'
         0. Error_Reporter::trigger_fatal("failed to open db `/etc/php.ini'", ["/etc/php.ini"])
            [/usr/local/apnscp/lib/log_wrapper.php:45]
         1. fatal("failed to open db `%s'", "/etc/php.ini")
            [/usr/local/apnscp/lib/Opcenter/Map.php:58]
         2. Opcenter\Map->__construct("/etc/php.ini", "wd", "inifile", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:268]
         3. Opcenter\Map::load("/etc/php.ini", "wd", null)
            [/usr/local/apnscp/lib/Opcenter/Map.php:128]
         4. Opcenter\Map::write("/etc/php.ini")
            [/usr/local/apnscp/lib/Opcenter/Admin/Settings/System/Timezone.php:46]
         5. Opcenter\Admin\Settings\System\Timezone->set("Europe/Berlin")
            [/usr/local/apnscp/lib/modules/scope.php:68]
         6. Scope_Module->set("system.timezone", "Europe/Berlin")
            [/usr/local/apnscp/lib/Module/Skeleton/Standard.php:145]
         7. Module\Skeleton\Standard->_invoke("set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/apnscpfunction.php:992]
         8. apnscpFunctionInterceptor->call("scope_set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/CLI/cmd.php:62]
         9. CLI\__call("scope_set", ["system.timezone", "Europe/Berlin"])
            [/usr/local/apnscp/lib/CLI/cmd.php:581]
        10. CLI\main()
            [/usr/local/apnscp/bin/cmd:7]
ERROR: fatal(): failed to open db `/etc/php.ini'

Steps to Reproduce

  • Step 1:
    • Installing with the following command: curl https://raw.githubusercontent.com/apisnetworks/apiscp-bootstrapper/master/bootstrap.sh | bash -s - -s use_robust_dns='true' -s has_dns_only='true' -s whitelist_ip='<my-vpn-ip-address>' -s has_low_memory='true' -s limit_memory_2gb="1600" -s limit_memory_1gb="800" -s apnscp_admin_user='admin' -s apnscp_admin_email='admin@domain.tld' -s system_hostname='master.domain.tld'
  • Login to ApisCP Web UI and trying to set Configuration → system.timezone to “Europe/Berlin” and trying to set the timezone from user “admin” to “Europe/Berlin”
  • See errors above

Expected Behavior

Expecting to set the timezone for system and admin user without issues

Actual Behavior

When trying to set the admin timezone i get a empty site. When calling again the Dashboard, its shows that error above in a error box. When trying to set the system.timezone i get the error upper right as notification error box.

Environment

ApisCP version:
revision: fe41ead6f8212b4982f57c27bd455ddc22d19c4e
timestamp: 1693411074
ver_maj: 3
ver_min: 2
ver_patch: 38
ver_pre: ‘’
dirty: false
debug: false

Operating System:
Rocky Linux 8
4.18.0-477.21.1.el8_8.x86_64

Additional Information:
I can login while i’m not connected to my vpn? Something does not worked with the whitelist ip address?

Further is it possible to set system.timezone while installation? Didnt found anything about it.

//Edit

maybe it has to do with this?
https://bitbucket.org/apisnetworks/apnscp/branches/compare/fe41ead6f8212b4982f57c27bd455ddc22d19c4e..7e19cbedab0437db3a45cf802d662060a2942f81#commits


My question about locales:
Where can i find supported locales, install them or - if not supported - create my own? (de_DE)

Smells like this didn’t install. /etc/php.ini is created when PHP is built for the server, unless it was removed.

grep -m1 failed=1 -B20 /root/apnscp-bootstrapper.log

Does this report anything? If not, upcp -sbf php/install will force a build of PHP as well as regenerate php.ini for the server.

2023-08-31 12:36:37,807 p=14180 u=root n=ansible | TASK [check-requirements : Fail if OS is not RHEL/CentOS] **********************
2023-08-31 12:36:37,829 p=14180 u=root n=ansible | skipping: [localhost]
2023-08-31 12:36:37,871 p=14180 u=root n=ansible | TASK [check-requirements : Fail if RHEL/CentOS is not sufficient version] ******
2023-08-31 12:36:38,210 p=14180 u=root n=ansible | ok: [localhost] => (item=/etc/centos-release)
2023-08-31 12:36:38,231 p=14180 u=root n=ansible | TASK [check-requirements : Fail if memory less than 1 GB] **********************
2023-08-31 12:36:38,252 p=14180 u=root n=ansible | skipping: [localhost]
2023-08-31 12:36:38,274 p=14180 u=root n=ansible | TASK [check-requirements : Fail if memory >= 1 GB and < 2 GB] ******************
2023-08-31 12:36:38,301 p=14180 u=root n=ansible | fatal: [localhost]: FAILED! => 
  msg: |-
    The conditional check 'ansible_memtotal_mb < limit_memory_2gb' failed. The error was: Unexpected templating type error occurred on ({% if ansible_memtotal_mb < limit_memory_2gb %} True {% else %} False {% endif %}): '<' not supported between instances of 'int' and 'AnsibleUnicode'
  
    The error appears to be in '/usr/local/apnscp/resources/playbooks/roles/check-requirements/tasks/main.yml': line 31, column 3, but may
    be elsewhere in the file depending on the exact syntax problem.
  
    The offending line appears to be:
  
      when: ansible_memtotal_mb < limit_memory_1gb
    - name: Fail if memory >= 1 GB and < 2 GB
      ^ here
2023-08-31 12:36:38,304 p=14180 u=root n=ansible | PLAY RECAP *********************************************************************
2023-08-31 12:36:38,304 p=14180 u=root n=ansible | localhost                  : ok=7    changed=1    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0

But i solved this by adding -s has_low_memory='true' -s limit_memory_2gb="1600" -s limit_memory_1gb="800"

upcp -sbf php/install

stdout is:

PLAY [localhost] **************************************************************************************************************************************************************************************************

PLAY RECAP ********************************************************************************************************************************************************************************************************
localhost                  : ok=12   changed=0    unreachable=0    failed=0    skipped=22   rescued=0    ignored=0   

So seems to be fine…So testing to change timezone: Working!

So there is just 3 tiny questions open on this:

  • does i need to reference the installation of php while installing with curl command to get rid of this with the next installations?
  • can i set system.timezone as Europe/Berlin while installation with "-s system_timezone=“Europe/Berlin”?
  • what about “languages”? I actually only can select United States/English and United Kingdom/English. Are there any more languages? If not, is there a way to create a own “language file”? If there are more languages - i cant find any within the documentation or in the web in general.

It failed earlier, so there may be multiple failures. Stopping after the first match would not be suitable. This would work instead,

grep failed=1 -B20 /root/apnscp-bootstrapper.log | tail -n21

Impossible to know without more information as what you cite is irregular.

You can drop in additional plays into /usr/local/apnscp/resources/playbooks/roles/custom/installed. For example, custom/installed/tasks/main.yml would be:

- name: Set system timezone
  command: {{ apnscp_root }}/bin/cmd scope:set system.timezone Europe/Berlin

Not at this time. English-only.

Is there a way to create my own locale files? I would be absolutely be ready to create a german language file.

afaik apiscp doesn’t have a language system yet, that’s why english (us) is the only available language

Ist there any task planned?

Not in the immediate future. Adopting additional languages increases support burden, which product design is a more important avenue to focus on at this point.

1 Like