PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] How to upgrade timezonedb/timelib on php7 (plesk onyx)?

 November 13, 2022     pecl, php, plesk, timezone, timezonedb     No comments   

Issue

im using PHP Version 7.0.31 on a Plesk Onyx system.

phpinfo() is showing me:

date
date/time support: enabled
timelib version: 2016.02
"Olson" Timezone Database Version   0.system
Timezone Database   internal
Default timezone    Europe/Berlin

The used timelib version "2016.02" is outdated so i need to upgrade it to the current version 2018.5 (https://pecl.php.net/package/timezonedb).

How to do that? "pecl upgrade timezonedb" didn't worked out and after hours of googling and trying i'm clueless...


Solution

Context

I've solved a similar problem in my company, but related to daylight saving time in Brazil. The time was 1 hour wrong in all our servers that uses PHP 7.0.32, while the servers that uses PHP 7.1 are working fine.

Our servers are running on AWS EC2 instances. Our timezone is America/Sao_Paulo. It's important to note that our main goal was "update timelib PHP extension", but we found that was not needed, since updating the timezone database version was enough to solve our problem.

Solution

In order to solve that outdated datetime, I've run the following commands from SSH, logged in as root user:

pecl7 install timezonedb

After that, we need to add the extension to our PHP.INI file. In my case it was loaded and located from /etc/php.ini. To check yours, just create a phpinfo.php file and check from which location your machine is loading the php.ini file:

enter image description here

Then, just run somewhat like:

nano /etc/php.ini

And then add the following line to the last line of your php.ini file:

extension=timezonedb.so

In order to check if the update has made sucessfully, restart php / php-fpm with the following command:

service php-fpm restart

Then, let's access again the PHPINFO and...

enter image description here



Answered By - Paladini
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing