tlenss / zabbix-sms-client

zabbix sms client script
MIT License
10 stars 10 forks source link

ERR 1005 #2

Closed totalnooob closed 5 years ago

totalnooob commented 5 years ago

Hi im getting ERR 1005

./sms.php +1 "Test" "Test" PHP Warning: Constants may only evaluate to scalar values in /usr/lib/zabbix/alertscripts/config.php on line 27 PHP Notice: Use of undefined constant GATEWAY_PARAMS - assumed 'GATEWAY_PARAMS' in /usr/lib/zabbix/alertscripts/sms.php on line 16 PHP Warning: Illegal string offset 'msg' in /usr/lib/zabbix/alertscripts/lib/Zabbix/Sms/Client/Budgetsms.php on line 29 PHP Warning: Illegal string offset 'to' in /usr/lib/zabbix/alertscripts/lib/Zabbix/Sms/Client/Budgetsms.php on line 30 PHP Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in /usr/lib/zabbix/alertscripts/lib/Zabbix/Sms/Client.php on line 108 PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/lib/zabbix/alertscripts/lib/Zabbix/Sms/Client.php on line 84 what should i do?

tlenss commented 5 years ago

I have not used this script in a while. But i will try to help :) What PHP version are you using? I assume <5.6

totalnooob commented 5 years ago

php 5.4.16 CentOS Linux release 7.5.1804 (Core)

mattrik commented 5 years ago

I have the same problem. php 5.4.16 CentOS Linux release 7.6.1810 (Core)

tlenss commented 5 years ago

Time to upgrade. PHP 5.4 has been EOL for a long time now. The last change makes use of constant arrays. This is not supported in php 5.4. You can change a line in sms.php to fix the issue

Change: $client = ZS\Factory::Get(GATEWAY_TYPE, GATEWAY_PARAMS);

To:

$client = ZS\Factory::Get(
    'Budgetsms', 
    array(
        'username' => 'CHANGEME',
        'userid' => 'CHANGEME',
        'handle' => 'CHANGEME',
        'from' => 'CHANGEME'
    )
);