Cacti 0.8.8.h and PHP 7.0 = incompatibilty
My system:
OS: OpenBSD 6.0
PHP version: 7.0
Database: Mariadb 10
RRDTool: 1.6.0
1. Before: if you have this error as below
#1071 - Specified key was too long; max key length is 1000 bytes
You don't use default collation in /etc/my.cnf.
Create database as below:
CREATE cactidb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
and import:
mysql --host="localhost" --user="root" --password="your_strong_secret_string" < /var/www/htdocs/cacti/cacti.sql
2. Well, if you have php 7.0:
To avoid error PHP message: PHP Parse error: syntax error, unexpected 'new' (T_NEW) in /htdocs/cacti/lib/adodb/adodb.inc.php on line xxxx.
Open /var/www/htdocs/cacti/lib/adodb/adodb.inc.php
you must remove the '&' character as below
Line 866:
replace $rs =& new ADORecordSet_empty();
by $rs = new ADORecordSet_empty();
Line 872:
replace $rs =& new $rsclass($this->_queryID,$this->fetchMode);
by $rs = new $rsclass($this->_queryID,$this->fetchMode);
Line 1183:
replace $rs2 =& new $arrayClass();
by $rs2 = new $arrayClass();
Line 1961:
replace $fld =& new ADOFieldObject();
by $fld = new ADOFieldObject();
Line 3027:
replace $this->_obj =& new ADOFetchObj();
by $this->_obj = new ADOFetchObj();
Line 3592:
replace $this->_obj =& new ADOFetchObj();
by $this->_obj = new ADOFetchObj();
Line 3667:
replace $perf =& new $class($conn);
by $perf = new $class($conn);
Line 3687:
replace $dict =& new $class();
by $dict = new $class();
Save file.
To avoid errors below:
PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() in /htdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php:355
PHP message: PHP Warning: mysqli_real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/www/run/mysql/mysql.sock' (2 "No such file or dire
ctory") in /htdocs/cacti/lib/adodb/drivers/adodb-mysqli.inc.php on line 83
PHP message: PHP Warning: mysqli_real_connect(): (HY000/2003): Can't connect to MySQL server on '127.0.0.1' (61 "Connection refused") in /htdocs/cacti/lib/adodb/driv
ers/adodb-mysqli.inc.php on line 83
PHP message: PHP Warning: mysqli_real_connect(): (HY000/2003): Can't connect to MySQL server on 'localhost' (61 "Connection refused") in /htdocs/cacti/lib/adodb/driv
ers/adodb-mysqli.inc.php on line 83
Open /var/www/htdocs/cacti/install/index.php
Line 66:
replace $extensions = array("session", "sockets", "mysql", "xml");
by $extensions = array("session", "sockets", "mysqli", "xml");
Comment: the database type is hard coded.
and
Open /var/www/htdocs/cacti/include/config.php
$database_type = "mysqli";
$database_default = "cactidb";
$database_hostname = "::1";
$database_username = "cacti";
$database_password = "your_strong_secret_string";
$database_port = "3306";
$database_ssl = false;
Comment:
set $database_type = "mysqli" because mysql has been removed in php 7.0
set hostname = "::1" because Mariadb listen on ::1 by default
3. Open /var/www/htdocs/cacti/lib/adodb/adodb-lib.inc.php
Line 537:
replace $recordSet =& new $rsclass(-1,$zthis->fetchMode);
by $recordSet = new $rsclass(-1,$zthis->fetchMode);
End !
Cacti 0.8.8h and PHP 7.0 - [RESOLVED]
Moderators: Developers, Moderators
-
- Posts: 1
- Joined: Thu Mar 08, 2018 9:37 pm
Re: Cacti 0.8.8h and PHP 7.0 - [RESOLVED]
thanks god, you saved me, thanks mate.
btw the ::1 get error so I revert to default "localhost"
btw the ::1 get error so I revert to default "localhost"
Who is online
Users browsing this forum: No registered users and 1 guest