Apache and/or php7 issue for mediawiki

Issues related to applications and software problems
Post Reply
cwatson
Posts: 134
Joined: 2007/10/02 18:55:02

Apache and/or php7 issue for mediawiki

Post by cwatson » 2020/10/01 02:12:41

Hi, I tried posting on the Mediawiki forum but didn't get any help.

I was previously running Mediawiki v1.27.4 on CentOS 7.3 (or 7.4). This is for a personal wiki; i.e., I don't need it to be accessible elsewhere and I always access it via localhost

I had to re-install CentOS (now running 7.8) and downloaded Mediawiki v1.33.1. I restored the previously backed-up database which was backed up by

Code: Select all

mysqldump -u wikiuser --password=${PASSWORD} wikidb -c | gzip > wikidb-$(date '%Y%m%d').sql.gz
Versions of other support software (since CentOS has lower native versions) include:
  • httpd24-httpd
  • php74 (installed via centos-release-scl)
  • mariadb (and mariadb-server)
I enabled all of the above as well.

When first logging into the MySQL client, I followed instructions to create the database wikidb with the same username and password as the old wiki. To import the backed-up database, I did

Code: Select all

tar xf wikidata-YYYYMMDD.sql.gz
gunzip wikidata-YYYYMMDD.sql.gz
mysql -u wikiuser -p wikidb < wikidb-YYYYMMDD.sql
I then edited some lines in httpd.conf, namely to change DocumentRoot and Directory to /var/www/html. I also changed DirectoryIndex to read

Code: Select all

index.html index.html.var index.php

I also ran

Code: Select all

php74 update.php --server "localhost"
in the maintenance directory.


Now when I point my browser to http://localhost/mediawiki/index.php it only shows the contents of the file, including

Code: Select all

If you are reading this in your web browser, your server is probably not configured correctly to run PHP applications!
I ran the command

Code: Select all

httpd -M
and it does show that php7_module is loaded/enabled. Any other ideas? If it helps, when I try to open phpMyAdmin in the browser it gives me a 404 Page not found error. I am not sure what changed after re-installing, because to the best of my knowledge I installed everything I had when it was previously working. Thanks.

P.S. I also see the following in /var/log/httpd24/error_log after restarting the service:

Code: Select all

[Wed Aug 05 19:20:13.425109 2020] [http2:warn] [pid 7010] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.

tunk
Posts: 794
Joined: 2017/02/22 15:08:17

Re: Apache and/or php7 issue for mediawiki

Post by tunk » 2020/10/01 15:31:48

Never used mediawiki, so I can't help you.
But if you consider starting from scratch,
then dokuwiki could be a simpler alternative.

User avatar
KernelOops
Posts: 347
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: Apache and/or php7 issue for mediawiki

Post by KernelOops » 2020/10/01 16:16:01

Since you are not using the default apache/php packages, I am not sure what you have changed, but I can guess that your configuration has broken the way apache calls php.

For example, the prefork mpm loads php via the php7_module (modules/libphp7.so), while the worker mpm loads php via the proxy handler that calls php-fpm.

So which mpm are you using?
--
I love my computer - all my friends live there.
--

User avatar
TrevorH
Forum Moderator
Posts: 29681
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Apache and/or php7 issue for mediawiki

Post by TrevorH » 2020/10/01 16:45:55

For running modern php it's recommended to use php-fpm not mod_php.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

cwatson
Posts: 134
Joined: 2007/10/02 18:55:02

Re: Apache and/or php7 issue for mediawiki

Post by cwatson » 2020/10/02 04:44:53

Thanks TrevorH. I tried to start php-fpm but got this error:

Code: Select all

Oct 01 23:30:51 localhost.localdomain php-fpm[16584]: [01-Oct-2020 23:30:51] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
Oct 01 23:30:51 localhost.localdomain php-fpm[16584]: [01-Oct-2020 23:30:51] ERROR: FPM initialization failed
I tried to see what is using it:

Code: Select all

[root@localhost php-fpm.d]$ netstat -tulnp | grep 9000
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      1632/php-fpm: maste 
I didn't change anything in /etc/php-fpm.d/www.conf because I wasn't sure if anything should be. Both user and group are set to apache.

Thanks for the help.

User avatar
TrevorH
Forum Moderator
Posts: 29681
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Apache and/or php7 issue for mediawiki

Post by TrevorH » 2020/10/02 08:18:27

By the looks of that, it didn't start because it was already running.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

cwatson
Posts: 134
Joined: 2007/10/02 18:55:02

Re: Apache and/or php7 issue for mediawiki

Post by cwatson » 2020/10/02 17:33:51

Any ideas what could be the problem, then? When I try to open (in the browser) a document that contains only

Code: Select all

<?php phpinfo(); ?>
the page is blank. I'm happy to provide more info.

cwatson
Posts: 134
Joined: 2007/10/02 18:55:02

Re: Apache and/or php7 issue for mediawiki

Post by cwatson » 2020/10/12 22:14:24

Hi, does anyone have any ideas on how I can fix this? I had a lot of useful information on that wiki and would love to be able to access it again.

Thanks!

User avatar
KernelOops
Posts: 347
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: Apache and/or php7 issue for mediawiki

Post by KernelOops » 2020/10/13 04:13:39

Read my reply above. Check if you use prefork or a worker/event module mpm. Because the way you call php changes drastically.

With the prefork mpm you use mod_php and with the event mpm you use a handler.

Whatever custom packages you installed, modified the default behaviour of CentOS 7, so you need to be aware what changed. At first glance, it seems like you use prefork, which does not support php-fpm. In that case, you need to switch to the event mpm. If you have already switched to event mpm, then you need to make sure you have a correct SetHandler option, so apache can connect to the right php-fpm daemon.
--
I love my computer - all my friends live there.
--

User avatar
remirepo
Posts: 402
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: Apache and/or php7 issue for mediawiki

Post by remirepo » 2020/10/13 07:21:34

> At first glance, it seems like you use prefork, which does not support php-fpm.

All MPM, including prefork, works with FPM.
Of course, it if better to use event, to take benefit of it when using FPM.
Remi's Repository - Forum - Blog

Post Reply

Return to “CentOS 7 - Software Support”