TIPS PHP Error Preventing Timezone Setup

aroundi

Member
Joined
Jul 6, 2017
Messages
33
Reaction score
4
Hello,

IPBX 2021 ubuntu 20.04 Asterisk 18/FPBX 15 (on-premise h/w)

I have an error when trying to use /root/timezone-setup

In Media.class.php line 283:
Array and string offset access syntax with curly braces is deprecated

Does anyone know the location of Media.class.php?

I'm trying to get sayunixtime to work with the correct time which is screwing up calendar announcements

Thanks
 
Hi,

/etc/php/7.4/cli/php.ini
starting at line #959:
[Date]
date.timezone = 'America/New_York'
;date.timezone = 'America/New_York'
;;date.timezone = 'America/New_York'
;;;date.timezone = 'America/New_York'
;;;;date.timezone = 'America/New_York'
;;;;;date.timezone = 'America/New_York'
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;;;;;;;date.timezone =

Location of Media.class.php?
 
have you tried:




Code:
timedatectl set-timezone America/New_York
 
Yes

fwconsole reload still returns

In Media.class.php line 283:

Array and string offset access syntax with curly braces is deprecated
 
In addition, the Freepbx gui is stuck on this error:

Function get_magic_quotes_gpc() is deprecated
 
Those are really not errors. More of a notice that those functions, or syntax used will be removed in future versions. Once that happens, then errors will occur.

What version of PHP is running on it?

Code:
php -v

This is confirmed to be running fine on Debian 10 which currently has version 7.3 of PHP.
 
Hi,

I have 5.6 and 7.4 directories in /etc/php/. In order to get sayunixtime working properly, I tried running /root/timezone-setup which threw an error. In the /root/timezone-setup script I noticed there were sed commands pointing to 7.3 which I changed to 7.4. /root/timezone-setup then ran successfully but with the In Media.class.php line 283: error. In addition, I can no longer access the Freepbx GUI; the login page goes directly to an error report page:
Whoops \ Exception \ ErrorException (E_DEPRECATED)
Function get_magic_quotes_gpc() is deprecated
After running /root/timezone-setup say unixtime runs correctly (eastern time) for a while but reverts back to a universal time some hours later.
 
Keep in mind that AvantFax will not work with PHP 7.x.
Hi Ward, this system is not using AvantFax, at the moment. Is the root utility /root/switch-to-php5.6 an option? Would it break something else? Would installing php7.3 create any problems, any special instructions?

It is mentioned they switched from PHP 7.4 to PHP version 7.3 and it was working again.

Also another mentioned
Hi KNERD, Yes, I noticed the php7.3 reference. Keep in mind my original /root/timezone-setup utility was hardcoded with reference to php7.3 which I changed.

The error page I get when trying to access the FreePBX GUI contains this (from
/var/www/html/admin/libraries/view.functions.php):
  1. if(get_magic_quotes_gpc()) {
  2. $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
  3. } else {
  4. $nt->delete('core', 'MQGPC');
  5. }
  6. }
  7. // setup locale
  8. // old... don't use!!
  9. function set_language($details=false) {
  10. return \FreePBX::View()->setLanguage(null,$details);
  11. }
I've checked
/etc/php/7.4/apache2/php.ini​
/etc/php/7.4/cli/php.ini​
/var/www/html/admin/.htaccess​
none cantain any reference to "magic" or "MQGPC"

I'm not sure where to check http., or what else to check.
 
If you dont see it in php. ini...you going to have to add it in
 
I have commented out the offending lines in view.functions.php (15 - 19). I am now able to access the FreePBX GUI. Dashboard shows a critical error
'fwconsole reload' failed, config not applied​
Array and string offset access syntax with curly braces is deprecated​

Reminding me of the cli error I mentioned in post #1

Is there someone who would be kind enough to tell me where I can find the file Media.class.php?
 
Nobody said anything about commenting anything out. I gave you the correct answer you needed.
 
Location of Media.class.php?
Bash:
root@incrediblepbx:~# find /var/www/html/ *.php | grep 'Media.class.php'
/var/www/html/admin/libraries/BMO/Media.class.php
try
/var/www/html/admin/libraries/BMO/Media.class.php
 
Running php 5.6 clears the problems allowing updating mods, reloading asterisk, and accessing the GUI with the lines
  • if(get_magic_quotes_gpc()) {
  • $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
  • } else {
  • $nt->delete('core', 'MQGPC');
  • }
in /var/www/html/admin/libraries/view.functions.php not commented.
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top