Cyber panel don't install. issue date_timezone

Cyber panel don’t install. issue date_timezone

https://www.uppic.org/images/2021/02/05/chrome_I6jvm0PxP7.png

easily fixed with the steps outlined in the bottom of this article.
https://hackerdise.com/how-to-update-php-timezone/

See specifically the last ones about it not being set at all.

For Cyberpanel this can be done the same way to check the current value.

For Centos:

for version in $(ls /usr/local/lsws|grep lsphp); do echo “”; echo “LSPHP $version”; /usr/local/lsws/${version}/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done

For Ubuntu:

for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; /usr/local/lsws/lsphp${phpver}/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done

This is the all in one command set to do this for Cyberpanel. Command uses “America/Phoenix” as the timezone in the example. Change this to your desired timezone database name from here.

Centos:

for version in $(ls /usr/local/lsws|grep lsphp); do echo “”; echo “PHP $version”; sed -i ‘s|^date.timezone.*|date.timezone = “America/Phoenix”|g’ /usr/local/lsws/${version}/etc/php.ini; /usr/local/lsws/${version}/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done

Ubuntu:

for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; sed -i -e ‘s|^date.timezone.*|date.timezone = “America/Phoenix”|g’ /usr/local/lsws/lsphp${phpver}/etc/php/$(echo $phpver | sed ‘s/^\(.\{1\}\)/\1./’)/litespeed/php.ini; /usr/local/lsws/lsphp${phpver}/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done; service lsws restart; killall lsphp;

Special Note if the date.timezone value is unset then the below custom sed command can be adjusted to uncomment and change that commented line into a valid one.

If no value set like the below.

root@server:~# for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; /usr/local/lsws/lsphp$phpver/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done

LSPHP 70
date.timezone => no value => no value

LSPHP 71
date.timezone => no value => no value

LSPHP 72
date.timezone => no value => no value

LSPHP 73
date.timezone => no value => no value

LSPHP 74
date.timezone => no value => no value

root@server:~#

Centos:

for version in $(ls /usr/local/lsws|grep lsphp); do echo “”; echo “PHP $version”; sed -i ‘s|^;date.timezone.*|date.timezone = “America/Phoenix”|g’ /usr/local/lsws/${version}/etc/php.ini; /usr/local/lsws/${version}/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done

Ubuntu:

for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; sed -i -e ‘s|^;date.timezone.*|date.timezone = “America/Phoenix”|g’ /usr/local/lsws/lsphp${phpver}/etc/php/$(echo $phpver | sed ‘s/^\(.\{1\}\)/\1./’)/litespeed/php.ini; /usr/local/lsws/lsphp${phpver}/bin/php -i |grep -Ei ‘date.timezone’ && echo “” ; done; service lsws restart; killall lsphp;

Hopefully you enjoyed this post and found how to rapidly change all the PHP version timezone to your desired ones.

For those curious the “killall lsphp” is there for those using LSAPI/LSPHP/Litespeed which has detached processes that don’t get restarted unless killed. Without that line it would look like the changes were not applied so this is a sanity timesaver to prevent people unfamiliar with that from wasting time wondering why the PHP changes don’t look like there working.