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

[dev.icinga.com #10251] Icinga Web 2 fails to run with PHP7 #2027

Closed
icinga-migration opened this issue Sep 30, 2015 · 27 comments

Comments

Projects
None yet
1 participant
@icinga-migration
Copy link
Member

commented Sep 30, 2015

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10251

Created by reubenfarrelly on 2015-09-30 10:40:04 +00:00

Assignee: elippmann
Status: Resolved (closed on 2016-02-02 12:51:30 +00:00)
Target Version: 2.2.0
Last Update: 2016-02-02 12:51:30 +00:00 (in Redmine)


I've been doing some testing with php-7.0.0-rc3 - now that the final release of php-7 is only a few weeks ago.

Unfortunately Icinga Web 2 (and 1 for that matter) both fail to run with php-7.0.0.

The problem occurs post installation, when first attempting to go to http://icinga2/ . A Fatal Error is shown in my browser and the apache error-log shows this:

[Wed Sep 30 20:33:09.673028 2015] [:error] [pid 3722] [client 2001:44b8:X] PHP Fatal error: Uncaught ErrorException: Only variables should be passed by reference in /usr/share/icinga-web2/library/Icinga/Util/Translator.php:259\nStack trace:\n#0 /usr/share/icinga-web2/library/Icinga/Util/Translator.php(259): Icinga\\Application\\ApplicationBootstrap~~Icinga\\Application\\{closure}(8, 'Only variables ...', '/usr/share/icin...', 259, Array)\n#1 [internal function]: Icinga\\Util\\Translator::Icinga\\Util\\{closure}(Array, Array)\n#2 /usr/share/icinga-web2/library/Icinga/Util/Translator.php(261): usort(Array, Object(Closure))\n#3 /usr/share/icinga-web2/library/Icinga/Application/Web.php(504): Icinga\\Util\\Translator::getPreferredLocaleCode('en-AU,en-US;q=0...')\n#4 /usr/share/icinga-web2/library/Icinga/Application/ApplicationBootstrap.php(615): Icinga\\Application\\Web~~>detectLocale()\n#5 /usr/share/icinga-web2/library/Icinga/Application/Web.php(92): Icinga\\Application\\ApplicationBootstrap->setupInternationalization()\n#6 /usr/share/icinga-web2/library/Icinga/Application/ApplicationBootstrap.php(337): Icinga\\Application\\We in /usr/share/icinga-web2/library/Icinga/Util/Translator.php on line 259

Soon after, this is also logged:

[Wed Sep 30 20:33:27.140443 2015] [:error] [pid 27638] [client 2001:44b8:X] PHP Fatal error: Cannot use Icinga\\Util\\String as String because 'String' is a special class name in /usr/share/icinga-web2/library/Icinga/Web/View/helpers/string.php on line 4

With the final release of php-7 not so far away it would be good if any Icinga Web 2/php-7 interoperability bugs were ironed out prior to release.

Changesets

2016-01-27 15:46:54 +00:00 by elippmann b043317

PHP7: Fix Only variables should be passed by reference exception in Translator

refs #10251

2016-01-27 15:46:55 +00:00 by elippmann 7fd5750

PHP7: Rename String to StringHelper

refs #10251

2016-01-27 15:52:32 +00:00 by elippmann c1f7b2e

PHP7: Fix Zend autoload issues

refs #10251

2016-01-28 12:52:31 +00:00 by elippmann 32f8728

PHP7: Fix MySQL and PostgreSQL PDO extension checks

refs #10251

Relations:

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Sep 30, 2015

Updated by elippmann on 2015-09-30 10:48:20 +00:00

  • Category changed from UI to Framework
  • Target Version set to 2.0.0
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Sep 30, 2015

Updated by reubenfarrelly on 2015-09-30 10:49:06 +00:00

I should add that this was tested with icinga-web-2 git as of commit e20d791 .

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Oct 1, 2015

Updated by elippmann on 2015-10-01 21:48:17 +00:00

  • Target Version changed from 2.0.0 to 273

Hi,

Thanks for the report. This won't make it into the final release but we add support for PHP7 asap.

Best,
Eric

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Nov 20, 2015

Updated by elippmann on 2015-11-20 13:11:14 +00:00

  • Target Version changed from 273 to Backlog
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Dec 3, 2015

Updated by mfriedrich on 2015-12-03 20:50:34 +00:00

PHP 7 is now final: http://php.net/archive/2015.php#id2015-12-03-1

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 24, 2016

Updated by purplecarrot on 2016-01-24 15:37:12 +00:00

This is what I get with 2.1.2:

Fatal error: Class 'Zend_Controller_Request_Http' not found in /usr/share/icingaweb2/library/Icinga/Web/Request.php on line 13
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 24, 2016

Updated by reubenfarrelly on 2016-01-24 21:20:56 +00:00

purplecarrot wrote:

This is what I get with 2.1.2:
[...]

I am getting that too now. I suspect there are multiple errors - this one now being the first.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 27, 2016

Updated by MichaelH_BE on 2016-01-27 03:36:58 +00:00

Hello

This weekend I've updated my Raspberry Pi2 with Icinga2 and Icingaweb2 installed on it. Unfortunately since the update the Icingaweb2 is not working anymore. I always get the error message

Fatal error: Class 'Zend_Controller_Request_Http' not found in /usr/share/webapps/icingaweb2/library/Icinga/Web/Request.php on line 13

Setup:
[admin@alarmpi4 Web]$ php -version
PHP 7.0.2 (cli) (built: Jan 21 2016 10:23:54) ( NTS )
Copyright © 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright © 1998-2015 Zend Technologies

[admin@alarmpi4 Web]$ yaourt -Q zendframework
local/zendframework 1.12.17-1

[admin@alarmpi4 Web]$ sudo pacman -Q icingaweb2
icingaweb2 2.1.2-1

[admin@alarmpi4 Web]$ sudo pacman -Q apache
apache 2.4.18-1

[admin@alarmpi4 Web]$ uname -a
Linux alarmpi4 4.1.15-5-ARCH #1 SMP Wed Jan 20 14:05:45 MST 2016 armv7l GNU/Linux

What I already have done:
I've added the path to the zendframework library in the php.ini file

[admin@alarmpi4 Web]$ php -r "echo get_include_path();"
.:/php/includes:/usr/share/zendframework/library

I also get the error when I call the methode on the command line
[admin@alarmpi4 Web]$ php Request.php
PHP Fatal error: Class 'Zend_Controller_Request_Http' not found in /usr/share/webapps/icingaweb2/library/Icinga/Web/Request.php on line 13

I am still quite new so please do not hesitate to ask stupid question or make such recommendations. I placed the same question in the forum http://www.monitoring-portal.org and was asked to document the issue here as well. What I herewith do.

Regards
Michael

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 27, 2016

Updated by purplecarrot on 2016-01-27 13:55:15 +00:00

@lippser Although I'm not very experienced with PHP, I dug a bit and it seems that Zend_Loader_Autoloader is never called, only the Icinga one is.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 27, 2016

Updated by elippmann on 2016-01-27 15:26:54 +00:00

  • Subject changed from Icinga Web 2 fails to run with php-7.0.0-rc3 to Icinga Web 2 fails to run with PHP7
  • Status changed from New to Assigned
  • Assigned to set to elippmann
  • Target Version changed from Backlog to 2.2.0

Hi all,

Will be fixed tomorrow.

Best,
Eric

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by elippmann on 2016-01-28 11:32:24 +00:00

Please test :)

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by icinga-kanban on 2016-01-28 11:36:55 +00:00

Build !#1227 triggered by the commits b5cbf49, ba9aead, dee6f4d, e45723c, 6ad40b5, 027aaac, 16bd78a, c1f7b2e, 41c05c3, 7fd5750, b043317, e9bc11d, f876ed0, 41c942d, 78c1e17, c963ee2, 9f79f9a, 5b7f4cd, 134061f, f7ba48e, f5945ff, ec177e7, 2e1e0bb passed successfully.

Branch: origin/master
Author: Eric Lippmann

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by purplecarrot on 2016-01-28 11:46:05 +00:00

lippser wrote:

Please test :)

This seems to work well, I had an issue with /etc/dashboards/ though, had to create it manually. Should I open another bug?

#0 [internal function]: Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(2, 'opendir(/etc/ic...', '/usr/share/icin...', 60, Array)
#1 /usr/share/icingaweb2/library/Icinga/Legacy/DashboardConfig.php(60): opendir('/etc/icingaweb2...')
#2 /usr/share/icingaweb2/library/Icinga/Web/Widget/Dashboard.php(119): Icinga\Legacy\DashboardConfig::listConfigFilesForUser(Object(Icinga\User))
#3 /usr/share/icingaweb2/library/Icinga/Web/Widget/Dashboard.php(88): Icinga\Web\Widget\Dashboard->loadUserDashboards()
#4 /usr/share/icingaweb2/application/controllers/DashboardController.php(34): Icinga\Web\Widget\Dashboard->load()
#5 /usr/share/icingaweb2/library/Icinga/Web/Controller/ActionController.php(133): Icinga\Controllers\DashboardController->init()
#6 /usr/share/icingaweb2/library/Icinga/Web/Controller/Dispatcher.php(59): Icinga\Web\Controller\ActionController->__construct(Object(Icinga\Web\Request), Object(Icinga\Web\Response), Array)
#7 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#8 /usr/share/icingaweb2/library/Icinga/Application/Web.php(390): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#9 /usr/share/icingaweb2/library/Icinga/Application/webrouter.php(109): Icinga\Application\Web->dispatch()
#10 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/icin...')
#11 {main}
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by elippmann on 2016-01-28 11:51:13 +00:00

Thanks for the fast response. I fixed the other bug too.

purplecarrot wrote:

lippser wrote:
> Please test :)

This seems to work well, I had an issue with /etc/dashboards/ though, had to create it manually. Should I open another bug?
[...]

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by reubenfarrelly on 2016-01-28 12:09:08 +00:00

lippser wrote:

Please test :)

Looks much better. I am going through the setup process again and at least now it loads the page.

However I'm getting stuck at the Modules page. All items are green except the following:

The PHP module LDAP is missing
The PHP module PDO-MySQL is missing.
The PHP module PDO-PostgreSQL is missing.
The PHP module PDO-MySQL is missing.
The PHP module PDO-PostgreSQL is missing.

As they're yellow I'm assuming that they are not required, but optional.

However I cannot click on the Next option. I've tried with latest Edge, Firefox and Chrome, and they all behave the same. Clicking on Next does nothing.

As a second possible problem, are all of those modules being correctly identified with PHP7 ?

php -i shows:


pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $


I have mysql/mysqli support (but not LDAP or PostgreSQL) in my php7 build so I would have thought it would work but...

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by elippmann on 2016-01-28 12:24:13 +00:00

One moment please :)

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by icinga-kanban on 2016-01-28 12:55:22 +00:00

Build !#1230 triggered by commit 32f8728 passed successfully.

Branch: origin/master
Author: Eric Lippmann

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by reubenfarrelly on 2016-01-28 12:59:07 +00:00

lippser wrote:

One moment please :)

That commit fixed it - detected properly and now I'm able to click through Next. Thanks :-) I hope that a system that really doesn't have MySQL support spits out an error message of some sort rather than silently failing though.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by reubenfarrelly on 2016-01-28 13:20:54 +00:00

reubenfarrelly wrote:

lippser wrote:
> One moment please :)

That commit fixed it - detected properly and now I'm able to click through Next. Thanks :-) I hope that a system that really doesn't have MySQL support spits out an error message of some sort rather than silently failing though.

Last error - all the way through to the very end now and I'm getting this:

Sorry! Failed to set up Icinga Web 2 successfully.
Back

Successfully connected to existing database "icinga-web2"...
Database schema already exists...
Login "icinga_web" already exists...
Granting required privileges to login "icinga_web"...
Failed to fully setup the database. An error occured:
ERROR: PDOException in /usr/share/icingaweb2/modules/setup/library/Setup/Utils/DbTool.php:416 with message: SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table

Module "doc" has been successfully enabled.
Module "iframe" has been successfully enabled.
Module "monitoring" has been successfully enabled.

The icinga-web2 database has 4 tables but they are all completely empty (0 rows). The Database Setup username is root (presumably this is only used for the database setup itself, not for regular access).

I am not sure if this is a PHP7 specific error though. But aside from this error the actual setup wizard itself seems to be good now all the way to the end.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2016

Updated by reubenfarrelly on 2016-01-28 14:27:43 +00:00

reubenfarrelly wrote:

reubenfarrelly wrote:
> lippser wrote:
> > One moment please :)
>
> That commit fixed it - detected properly and now I'm able to click through Next. Thanks :-) I hope that a system that really doesn't have MySQL support spits out an error message of some sort rather than silently failing though.

Last error - all the way through to the very end now and I'm getting this:

Sorry! Failed to set up Icinga Web 2 successfully.
Back

Successfully connected to existing database "icinga-web2"...
Database schema already exists...
Login "icinga_web" already exists...
Granting required privileges to login "icinga_web"...
Failed to fully setup the database. An error occured:
ERROR: PDOException in /usr/share/icingaweb2/modules/setup/library/Setup/Utils/DbTool.php:416 with message: SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table

Module "doc" has been successfully enabled.
Module "iframe" has been successfully enabled.
Module "monitoring" has been successfully enabled.

The icinga-web2 database has 4 tables but they are all completely empty (0 rows). The Database Setup username is root (presumably this is only used for the database setup itself, not for regular access).

I am not sure if this is a PHP7 specific error though. But aside from this error the actual setup wizard itself seems to be good now all the way to the end.

Turns out the problem was that the database account was being created by the setup wizard but was not being given permissions to access the newly created database. Once I manually fixed this up the setup was able to finish and I am now able to log in.

After now being able to log in it looks like everything else is now all working with PHP7. Thanks!

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 29, 2016

Updated by jmeyer on 2016-01-29 12:11:46 +00:00

Hey reubenfarrelly,

Can you please show me the results of the following three queries while you're logged in from the host where Icinga Web 2 is running?

select current_user();
select grantee from information_schema.schema_privileges where grantee like '%icinga_web%';
select grantee from information_schema.table_privileges where grantee like '%icinga_web%';

I'd like to investigate this error further, as it shouldn't actually happen during the setup wizard.

Thanks,
Johannes

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 29, 2016

Updated by reubenfarrelly on 2016-01-29 12:55:51 +00:00

Johannes wrote:

Hey reubenfarrelly,

Can you please show me the results of the following three queries while you're logged in from the host where Icinga Web 2 is running?

select current_user();
select grantee from information_schema.schema_privileges where grantee like '%icinga_web%';
select grantee from information_schema.table_privileges where grantee like '%icinga_web%';

I'd like to investigate this error further, as it shouldn't actually happen during the setup wizard.

Thanks,
Johannes

Sure:

thunderstorm ~ # mysql -u icinga-web2 -h localhost icinga-web2 -p
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9930
Server version: 10.1.10-MariaDB-log Source distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [icinga-web2]> select current_user();
+----------------+
| current_user() |
+----------------+
| icinga-web2@%  |
+----------------+
1 row in set (0.00 sec)

MariaDB [icinga-web2]> select grantee from information_schema.schema_privileges where grantee like '%icinga_web%';
+-------------------+
| grantee           |
+-------------------+
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
| 'icinga-web2'@'%' |
+-------------------+
18 rows in set (0.00 sec)

MariaDB [icinga-web2]> select grantee from information_schema.table_privileges where grantee like '%icinga_web%';
Empty set (0.00 sec)

MariaDB [icinga-web2]>

The steps to reproduce and fix:

  • Go through the wizard right to the end
  • Attempt to submit the data
  • It failed to submit with the error previously noted (although I think it may have actually done some of the setup work at that stage)
  • Go into phpmyadmin and go into the User Accounts section. Grant the icinga-web2 user full access to the icinga-web2 database
  • Resubmit the data again and it should succeed

Thanks,
Reuben

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 29, 2016

Updated by jmeyer on 2016-01-29 13:35:33 +00:00

Thanks. Did you create the user "icinga_web" prior to the wizard manually or by using phpmyadmin? If so, did you also grant any privileges for this user?

Im asking, because the log you've posted clearly says that the database and the user already existed, but not all privileges were granted to the user. Or did you run the wizard once more prior to posting the log here? (i.e you've encountered the error, but the database and user were created by the wizard at this time.)

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 29, 2016

Updated by reubenfarrelly on 2016-01-29 13:45:26 +00:00

Johannes wrote:

Thanks. Did you create the user "icinga_web" prior to the wizard manually or by using phpmyadmin? If so, did you also grant any privileges for this user?

Im asking, because the log you've posted clearly says that the database and the user already existed, but not all privileges were granted to the user. Or did you run the wizard once more prior to posting the log here? (i.e you've encountered the error, but the database and user were created by the wizard at this time.)

Hmm I did run the wizard more than once. I'll try a completely clean install in the next day both of the configs and database and come back to you with how it goes (and if it's reproducible).

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Feb 2, 2016

Updated by reubenfarrelly on 2016-02-02 12:21:50 +00:00

reubenfarrelly wrote:

Johannes wrote:
> Thanks. Did you create the user "icinga_web" prior to the wizard manually or by using phpmyadmin? If so, did you also grant any privileges for this user?
>
> Im asking, because the log you've posted clearly says that the database and the user already existed, but not all privileges were granted to the user. Or did you run the wizard once more prior to posting the log here? (i.e you've encountered the error, but the database and user were created by the wizard at this time.)

Hmm I did run the wizard more than once. I'll try a completely clean install in the next day both of the configs and database and come back to you with how it goes (and if it's reproducible).

I've just recreated this issue. A clean install, with no existing configuration. The icingaweb2 database was dropped along with the icinga-web2 username and the entire /etc/icingaweb2/ directory (I think this removes everything?).

I created the /etc/icingaweb2/ directory and with the permissions as of the front page. Then I went through the wizard right to the end but was still greeted with this final message when finishing on the very last page:

Creating new database "icinga-web2"...
Creating database schema...
Creating login "icinga-web2"...
Granting required privileges to login "icinga-web2"...
Failed to fully setup the database. An error occured:
ERROR: PDOException in /usr/share/icingaweb2/modules/setup/library/Setup/Utils/DbTool.php:416 with message: SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table

Module "doc" has been successfully enabled.
Module "iframe" has been successfully enabled.
Module "monitoring" has been successfully enabled.

The icinga-web2 user was created but not granted privileges to the icinga-web2 database. I've just granted that new user icinga-web2 full privileges to the icinga-web2 database and have been able to submit and complete the wizard again.

So this certainly appears to be reproducible at least.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Feb 2, 2016

Updated by jmeyer on 2016-02-02 12:51:30 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

You have my thanks for reproducing this and confirming what I already suspected to be the case. I created a new issue: #11070

Closed as all php7 related issues were resolved.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Feb 2, 2016

Updated by jmeyer on 2016-02-02 12:52:25 +00:00

  • Relates set to 11070

@icinga-migration icinga-migration added this to the 2.2.0 milestone Jan 17, 2017

algitbot pushed a commit to alpinelinux/aports that referenced this issue May 4, 2017

community/icingaweb2: use php7, disable check()
PHP7 appears to be supported since release 2.2.0
Icinga/icingaweb2#2027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.