Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] Use of undefined constant #929

Closed
nerijus opened this issue Mar 29, 2020 · 10 comments
Closed

[HELP] Use of undefined constant #929

nerijus opened this issue Mar 29, 2020 · 10 comments
Assignees
Labels

Comments

@nerijus
Copy link

nerijus commented Mar 29, 2020

After updating to version 2.7, I get when trying to open ocsreports web interface:

[Sun Mar 29 15:56:46.347651 2020] [php7:warn] [pid 40336] [client 127.0.0.1:34210] PHP Warning:  Use of undefined constant SSL_KEY - assumed 'SSL_KEY' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 97, referer: https://example.lt/ocsreports/?function=visu_computers
[Sun Mar 29 15:56:46.347746 2020] [php7:warn] [pid 40336] [client 127.0.0.1:34210] PHP Warning:  Use of undefined constant SSL_CERT - assumed 'SSL_CERT' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 97, referer: https://example.lt/ocsreports/?function=visu_computers
[Sun Mar 29 15:56:46.347819 2020] [php7:warn] [pid 40336] [client 127.0.0.1:34210] PHP Warning:  Use of undefined constant CA_CERT - assumed 'CA_CERT' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 97, referer: https://example.lt/ocsreports/?function=visu_computers
[Sun Mar 29 15:56:46.347844 2020] [php7:warn] [pid 40336] [client 127.0.0.1:34210] PHP Warning:  Use of undefined constant SERVER_PORT - assumed 'SERVER_PORT' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 97, referer: https://example.lt/ocsreports/?function=visu_computers
[Sun Mar 29 15:56:46.347865 2020] [php7:warn] [pid 40336] [client 127.0.0.1:34210] PHP Warning:  Use of undefined constant ENABLE_SSL - assumed 'ENABLE_SSL' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 156, referer: https://example.lt/ocsreports/?function=visu_computers
@Ludovicis
Copy link

Same error

@gillesdubois
Copy link
Member

Hi Guys,

DBConfig file have changed if you tried to re-import it from ther older version it won't work.

Regards,
Gilles Dubois.

@nerijus
Copy link
Author

nerijus commented Mar 30, 2020

You are right - after I added a few new variables to /etc/ocsinventory/ocsinventory-reports/dbconfig.inc.php (from /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php) errors went away.
But now I get empty page with a warning "NO TAG ASSIGNED TO YOUR PROFILE" and in ssl_error_log:
PHP Warning: array_search() expects parameter 2 to be array, null given in /usr/share/ocsinventory-reports/ocsreports/require/html_header.php on line 236

@gillesdubois
Copy link
Member

gillesdubois commented Mar 30, 2020

Please use the install.php instead of adding the variables manually.

@nerijus
Copy link
Author

nerijus commented Mar 30, 2020

I did, it said Your database is OK.
No action taken.
Click here to enter OCS-NG GUI

After I enter OCS-NG GUI the same error.

@Ludovicis
Copy link

ok DBConfig file have changed has resolv my problem.
I had the problem "NO TAG ASSIGNED TO YOUR PROFILE"
I disconnect my user and reconnect with admin credentials, and now it's ok for me.
Thanks Gilles Dubois

@nerijus
Copy link
Author

nerijus commented Mar 30, 2020

Thank you, logoff and logon helped.

@nerijus nerijus closed this as completed Mar 30, 2020
@roberthchan
Copy link

And dont forget modify /etc/apache2/conf-available/z-ocsinventory-server.conf
PerlSetEnv OCS_DB_USER ocsweb
PerlSetVar OCS_DB_PWD “Password”

@sbraz
Copy link
Contributor

sbraz commented May 20, 2020

Just ran into that:
The error log contained

[Wed May 20 15:43:13.792161 2020] [php7:warn] [pid 114331] [client :41144] PHP Warning:  Use of undefined constant ENABLE_SSL - assumed 'ENABLE_SSL' (this will throw an Error in a future version of P
HP) in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 156
[Wed May 20 15:43:13.794343 2020] [php7:warn] [pid 114331] [client :41144] PHP Warning:  Use of undefined constant ENABLE_SSL - assumed 'ENABLE_SSL' (this will throw an Error in a future version of P
HP) in /usr/share/ocsinventory-reports/ocsreports/backend/require/connexion.php on line 31
[Wed May 20 15:43:13.794382 2020] [php7:warn] [pid 114331] [client :41144] PHP Warning:  Use of undefined constant SERVER_PORT - assumed 'SERVER_PORT' (this will throw an Error in a future version of
 PHP) in /usr/share/ocsinventory-reports/ocsreports/backend/require/connexion.php on line 45
[Wed May 20 15:43:13.794404 2020] [php7:warn] [pid 114331] [client :41144] PHP Warning:  mysqli_real_connect() expects parameter 6 to be int, string given in /usr/share/ocsinventory-reports/ocsreport
s/backend/require/connexion.php on line 45
[Wed May 20 15:43:13.794427 2020] [php7:warn] [pid 114331] [client :41144] PHP Warning:  mysqli_select_db() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/
backend/identity/methode/local.php on line 36
[Wed May 20 15:43:13.794459 2020] [php7:warn] [pid 114331] [client :41144] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/requ
ire/function_commun.php on line 104

/var/lib/ocsinventory-reports/logs/log.csv contained the following error: ;ERROR_IDENTITY;NO RIGHTS LEVEL DEFINED TO YOUR PROFILE.

I don't think this should be closed. The login page should redirect to install.php and it shouldn't be necessary to log out to be able to access the interface again.

IMO if upgrades are likely to require user intervention, maybe there should be different RPM repositories for major updates.

@V0072
Copy link

V0072 commented Oct 18, 2020

other topic: if you upgrade from 2.6 to 27 or 2.8 and some define rows are missing, the whole ocsreports site won't be loaded.
PS: I force https!

So that's why in the dbconfig.inc.php I had to add the following lines:
define("SSL_KEY","");
define("SSL_CERT","");
define("CA_CERT","");
define("SERVER_PORT","3306");
define("ENABLE_SSL","1");

it solved the blank page problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants