Issue with php not during install

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Issue with php not during install

Post by Rno »

Hello again,
I have some issue with the install of cacti on my new server.
During the install process, it check the setup, but it told me that /usr/bin/php is not a valid location, but it is:

Code: Select all

 #which php                                                                                                                                                
/usr/bin/php
And the required module are displayed as 'Not installed' on CLI, but on web it's ok.
Can the 'supposedly' missing php can affect this error ?

How can investigated this issue ?

I'm running php 8.2.13, but I also have php-fpm and I have no clue what is the interaction of it (It's installed by default on our Linux server)

I've got this error on php-fpm error log:
[21-Dec-2023 10:35:36 Europe/Zurich] PHP Warning: Trying to access array offset on value of type null in /usr/share/cacti/lib/installer.php on line 1814
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

Doing the cli_check.php in CLI give me this result:

Code: Select all

 php ../install/cli_check.php  recommends
[{"name":"location","value":"\/etc\/php.ini","current":"\/etc\/php.ini","status":2},{"name":"version","value":"5.4.0","current":"8.2.13","status":3},{"name":"memory_limit","value":"400M","current":"512M","status":3},{"name":"max_execution_time","value":60,"current":"0","status":3},{"name":"date.timezone","value":"<timezone>","current":"Europe\/Zurich","status":3}]
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Issue with php not during install

Post by TheWitness »

What version of Cacti is this? Was the MariaDB TimeZone database loaded?
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

Cacti 1.2.25
and yes the Timezone is loaded, and cacti is happy with that part.
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Issue with php not during install

Post by TheWitness »

I would consider moving to the REMI PHP repositories. I'm using that almost exclusively, and not having any issues. php-fpm is a pain by the way.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

actually it's php 8.2.13 from the remi repo.

Code: Select all

Name         : php
Version      : 8.2.13
Release      : 1.el8.remi
Architecture : x86_64
Size         : 5.3 M
Source       : php-8.2.13-1.el8.remi.src.rpm
Repository   : @System
From repo    : remi-modular
Summary      : PHP scripting language for creating dynamic web sites
URL          : http://www.php.net/
License      : PHP-3.01 AND Zend-2.0 AND BSD-2-Clause AND MIT AND Apache-1.0 AND NCSA AND BSL-1.0
Description  : PHP is an HTML-embedded scripting language. PHP attempts to make it
             : easy for developers to write dynamically generated web pages. PHP also
             : offers built-in database integration for several commercial and
             : non-commercial database management systems, so writing a
             : database-enabled webpage with PHP is fairly simple. The most common
             : use of PHP coding is probably as a replacement for CGI scripts.
             : 
             : The php package contains the module (often referred to as mod_php)
             : which adds support for the PHP language to Apache HTTP Server.

Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: Issue with php not during install

Post by Osiris »

1.2.26 was just released. Give it a whirl.
Before history, there was a paradise, now dust.
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

Okay I downloaded 1.2.26, and still same error with php not able to run via cli.

I try to find if it's an issue with SELinux, but I can't find any log telling me it wasn't happy
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

I try to dig a little by further, and I find this:
On the function

Code: Select all

utility_php_recommends
(inside lib/utility.php)
I add this two log line:

Code: Select all

cacti_log('utility_php_recommends: ' . print_r($json, true), true, 'INSTALL' );
cacti_log('utility_php_recommends 2: ' . print_r($ext, true), true, 'INSTALL' );
Just before the call to

Code: Select all

utility_php_verify_recommends($ext['web'], 'web');

and here is the output:

Code: Select all

2024-01-03 11:24:30 - INSTALL utility_php_recommends: FATAL: Connection to Cacti database failed. Please ensure: - the PHP MySQL module is installed and enabled. - the database is running. - the credentials in config.php are valid. 
2024-01-03 11:24:30 - INSTALL utility_php_recommends 2: Array ( [web] => [cli] => ) 
Even if I'm using proxysql on it, when I do a CLI with mysql with the same credential of cacti, it works.
And the whole database was setup correctly during the install.
So the access is working from inside Cacti, except for this part!

I even try to access directly to the DB server, who is on on a remote machine, it give me the same situation.

I'm wondering if the call to an external program cli_check.php who lost the settings to access the DB when it's on a remote server.
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

So I think I have my finger on it.

When I do a

Code: Select all

php -m
all my module seams to be loaded correctly.
But when I do that under apache user, i got this 2 error:

Code: Select all

sudo -u apache php -m

PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/php/modules/mysqli (/usr/lib64/php/modules/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mysqli.so (/usr/lib64/php/modules/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib64/php/modules/pdo_mysql (/usr/lib64/php/modules/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_mysql.so (/usr/lib64/php/modules/pdo_mysql.so: undefined symbol: mysqlnd_get_client_info)) in Unknown on line 0
And both file exist:

Code: Select all

ls -l /usr/lib64/php/modules/mysqli.so
-rwxr-xr-x. 1 root root 167616 Dec 20 08:01 /usr/lib64/php/modules/mysqli.so

ls -l /usr/lib64/php/modules/pdo_mysql.so
-rwxr-xr-x. 1 root root 33672 Dec 20 08:01 /usr/lib64/php/modules/pdo_mysql.so
So why root is able to find the correct file and load it, but as apache user can't ?
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Rno
Cacti Pro User
Posts: 709
Joined: Wed Dec 07, 2011 9:19 am

Re: Issue with php not during install

Post by Rno »

Pff finally I find it
the problem was the right on the /etc/php.d/* some file didn't have read access for Other.

Now it's good
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests