Topic on Project:Support desk/Flow

PHP 7 not shown on MediaWiki 1.27

7
Tribly (talkcontribs)

I just recently updated my wiki from MediaWiki 1.26 to MediaWiki 1.27 (LTS) and decided since 1.27 supports PHP 7 I'm going to install it. I installed PHP 7 on my server and the necessary PHP extensions for MediaWiki 1.27. I also checked my PHP with the php -v command and it says I'm running PHP 7:

PHP 7.0.8-3+deb.sury.org~trusty+1 (cli) ( NTS )

Copyright (c) 1997-2016 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

with Zend OPcache v7.0.8-3+deb.sury.org~trusty+1, Copyright (c) 1999-2016, by Zend Technologies

But when I go to Special:Version page on my wiki it says I'm running 5.5.9-1ubuntu4.14 (apache2handler) PHP on my wiki. Am I really still running PHP 5.5.9 somehow or is this just some bug on the version page? And If by any chance I'm still running the older PHP how can I implement PHP 7 on my wiki?

87.123.33.176 (talkcontribs)

No, that is not a bug on the Version page.

It is possible to run different PHP versions when files are accessed through the webserver and from the shell. While you have PHP 7 on the shell, you are still using PHP 5.5 for webserver access.

Tribly (talkcontribs)

I see. And how can I make the wiki use PHP 7?

Ciencia Al Poder (talkcontribs)

Apparently, you need to install the libapache2-mod-php7.0 package or similar, otherwise only the php7 binary is installed, leaving apache with the old php5

Tribly (talkcontribs)

Alright, so I tried installing libapache2-mod-php7.0 package and getting rid of php 5 using the following commands:

sudo apt-get purge php5-fpm
sudo apt-get purge php5-common -y
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm php7.0-curl php7.0-gd php7.0-mysql php7.0-bz2

But there were still problems. My wiki went offline and gave an error. I also tried to restart apache with sudo service apache2 restart but that's also failed as well. Even after I restarted my virtual server it didn't worked. Finally I was able to solve the problem by disabling the php 5 module of apache with sudo a2dismod php5 then enabling the php 7 module with sudo a2enmod php7.0 then restarting apache with sudo service apache2 restart. Now everything seems to work fine. And on the version page of the wiki it says now that it using 7.0.8-3+deb.sury.org~trusty+1 (apache2handler)

Tribly (talkcontribs)

Okay, now a new problem arose. I can't block, unblock, rename, and merge people. I tried to log out and log in but I cannot log in anymore either. I get the following error:

There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Go back to the previous page, reload that page and then try again.
87.123.23.178 (talkcontribs)

> Now everything seems to work fine.

Nice to hear that your problem got solved.

For the problem with the session data, see Topic:T75cloz7981b8i92!