Access forbbiden in accessing moodle page on web server

Hi.

After upgrading Opensuse leap 42.3 to 15.1 I tried to access to my moodle server through http://localhost/moodle and I got a complete blank screen.
My web server works, other pages on the server load ok.
I have been researching and it seems it may be a problem with php7 not working well with moodle, so I downgraded to php 5.6. After that, connecting to http://localhost/moodle returns

Access forbidden! You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.

/srv/www/htdocs/moodle is drwxrwxr-x+ 46 root root

with


fperal@tutatis:/srv/www/htdocs> getfacl moodle
# file: moodle
# owner: root
# group: root
user::rwx
user:wwwrun:rwx
user:fperal:rwx
group::r-x
mask::rwx
other::r-x
default:user::rwx
default:user:wwwrun:rwx
default:user:fperal:rwx
default:group::r-x
default:mask::rwx
default:other::r-x


There is no index.html in moodle, but index.php


fperal@tutatis:/srv/www/htdocs/moodle> ls -l
total 576
drwxrwxr-x+ 11 root root  4096 ene 19  2016 admin
drwxrwxr-x+ 19 root root  4096 sep 22  2013 auth
drwxrwxr-x+  7 root root  4096 sep 22  2013 backup
drwxrwxr-x+  5 root root  4096 sep 22  2013 badges
-rw-rwxr--+  1 root root   354 sep 22  2013 behat.yml.dist
drwxrwxr-x+ 43 root root  4096 nov 30  2018 blocks
drwxrwxr-x+  3 root root  4096 sep 22  2013 blog
-rw-rwxr--+  1 root root  1162 sep 22  2013 brokenfile.php
drwxrwxr-x+  6 root root  4096 sep 22  2013 cache
drwxrwxr-x+  6 root root  4096 sep 22  2013 cache.bak
drwxrwxr-x+  4 root root  4096 sep 22  2013 calendar
drwxrwxr-x+  3 root root  4096 sep 22  2013 cohort
drwxrwxr-x+  2 root root  4096 sep 22  2013 comment
drwxrwxr-x+  4 root root  4096 sep 22  2013 completion
-rw-rwxr--+  1 root root   296 sep 22  2013 composer.json
-rw-rwxr--+  1 root root 32438 sep 22  2013 config-dist.php
-rw-rwxr--+  1 root root   744 nov  9  2018 config.php
-rw-rwxr--+  1 root root 35147 sep 22  2013 COPYING.txt
drwxrwxr-x+  7 root root  4096 sep 22  2013 course
-rw-rwxr--+  1 root root  2594 sep 22  2013 draftfile.php
drwxrwxr-x+ 17 root root  4096 sep 22  2013 enrol
drwxrwxr-x+  2 root root  4096 sep 22  2013 error
-rw-rwxr--+  1 root root  3923 sep 22  2013 file.php
drwxrwxr-x+  3 root root  4096 sep 22  2013 files
drwxrwxr-x+ 14 root root  4096 sep 22  2013 filter
drwxrwxr-x+  8 root root  4096 sep 22  2013 grade
drwxrwxr-x+  3 root root  4096 sep 22  2013 group
-rw-rwxr--+  1 root root  1423 sep 22  2013 help_ajax.php
-rw-rwxr--+  1 root root  1761 sep 22  2013 help.php
-rw-rwxr--+  1 root root 13203 sep 22  2013 index.php
drwxrwxr-x+  3 root root  4096 sep 22  2013 install
-rw-rwxr--+  1 root root 24004 sep 22  2013 install.php
drwxrwxr-x+  3 root root  4096 sep 22  2013 iplookup
drwxrwxr-x+  3 root root  4096 sep 22  2013 lang
drwxrwxr-x+ 41 root root  4096 sep 22  2013 lib
drwxrwxr-x+  2 root root  4096 sep 22  2013 local
drwxrwxr-x+  2 root root  4096 sep 22  2013 login
-rw-rwxr--+  1 root root 50620 sep 22  2013 mdeploy.php
-rw-rwxr--+  1 root root 10838 sep 22  2013 mdeploytest.php
drwxrwxr-x+  4 root root  4096 sep 22  2013 message
drwxrwxr-x+  4 root root  4096 sep 22  2013 mnet
drwxrwxr-x+ 25 root root  4096 nov 30  2018 mod
drwxrwxr-x+  2 root root  4096 sep 22  2013 my
drwxrwxr-x+  3 root root  4096 sep 22  2013 notes
-rw-rwxr--+  1 root root  5054 sep 22  2013 phpunit.xml.dist
drwxrwxr-x+ 13 root root  4096 sep 22  2013 pix
drwxrwxr-x+  2 root root  4096 sep 22  2013 plagiarism
-rw-rwxr--+  1 root root  1376 sep 22  2013 pluginfile.php
drwxrwxr-x+  8 root root  4096 sep 22  2013 portfolio
drwxrwxr-x+  7 root root  4096 sep 22  2013 question
drwxrwxr-x+  3 root root  4096 sep 22  2013 rating
-rw-rwxr--+  1 root root   760 sep 22  2013 README.txt
drwxrwxr-x+ 15 root root  4096 sep 22  2013 report
drwxrwxr-x+ 23 root root  4096 sep 22  2013 repository
drwxrwxr-x+  2 root root  4096 sep 22  2013 rss
drwxrwxr-x+  2 root root  4096 sep 22  2013 tag
-rw-rwxr--+  1 root root   935 sep 22  2013 tags.txt
drwxrwxr-x+ 26 root root  4096 sep 22  2013 theme
-rw-rwxr--+  1 root root  1334 sep 22  2013 TRADEMARK.txt
drwxrwxr-x+  7 root root  4096 sep 22  2013 user
drwxrwxr-x+  2 root root  4096 sep 22  2013 userpix
-rw-rwxr--+  1 root root  1635 sep 22  2013 version.php
drwxrwxr-x+  7 root root  4096 sep 22  2013 webservice
fperal@tutatis:/srv/www/htdocs/moodle> 


and accessing http://localhost/moodle/index.php returns a “you have chosen to open index.php” and options “open with” “save as…” (firefox)

So, maybe is a problem with php configuration?

best regards

Please show


sudo a2enmod -l

My suspicion is that php7 is not enabled, hence the option to download instead of process.

I agree with Knurpht.
Php is not enabled since it is wanting you to download the php file instead of open it.
If you use Yast -> HTTP sever to launch Apache, go to the module page and check php enable.
If by command line, I think you can do php -v to get the version of php being used ( 7.2.5 as example ).
Then a2enmod php7.2.5 to enable php.
Then restart apache ( service apache2 restart ).

good luck!

You were right, php was not enabled


root@tutatis:/home/fperal> a2enmod -l
authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap perl python reqtimeout authn_core authz_core mod_access_compat
root@tutatis:/home/fperal> 

I have enabled it


root@tutatis:/home/fperal> php -v
PHP 5.6.40 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

root@tutatis:/home/fperal> a2enmod php5.6.40

root@tutatis:/home/fperal> a2enmod -l
authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap perl python reqtimeout authn_core authz_core mod_access_compat php5.6.40
root@tutatis:/home/fperal>

And I restarted apache2.

But it did not change anything.

I have seen that a way to test php on apache is to make a file called for instance test.php with the following content:


<?php

	phpinfo();

?>

And locate it under /srv/www/htdocs then browsing to http://localhost/test.php will show info about php.
But in my case the result is that the browser download the file

AFAIK it should be


sudo a2enmod php

Where it could be that php should be php5.

I have changed from php5 to php7 and is the same.

I have tried as you say


tutatis:/etc/php7/cli # a2enmod php
tutatis:/etc/php7/cli # a2enmod -l
authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap perl python reqtimeout authn_core authz_core mod_access_compat mpm_prefork php7.2.5 php
tutatis:/etc/php7/cli # systemctl restart apache2
tutatis:/etc/php7/cli # a2dismod php7.2.5
tutatis:/etc/php7/cli # systemctl restart apache2
tutatis:/etc/php7/cli # a2enmod -l
authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap perl python reqtimeout authn_core authz_core mod_access_compat mpm_prefork php
tutatis:/etc/php7/cli # 


But is always the same.

in a console php works


fperal@tutatis:~> php /srv/www/htdocs/info.php

phpinfo()
PHP Version => 7.2.5

..........

Configuration File (php.ini) Path => /etc/php7/cli
Loaded Configuration File => /etc/php7/cli/php.ini
Scan this dir for additional .ini files => /etc/php7/conf.d
Additional .ini files parsed => /etc/php7/conf.d/ctype.ini,
/etc/php7/conf.d/dom.ini,
/etc/php7/conf.d/iconv.ini,
/etc/php7/conf.d/json.ini,
/etc/php7/conf.d/mysqli.ini,
/etc/php7/conf.d/pdo.ini,
/etc/php7/conf.d/pdo_mysql.ini,
/etc/php7/conf.d/pdo_sqlite.ini,
/etc/php7/conf.d/sqlite3.ini,
/etc/php7/conf.d/tokenizer.ini,
/etc/php7/conf.d/xmlreader.ini,
/etc/php7/conf.d/xmlwriter.ini

PHP API => 20170718
PHP Extension => 20170718
Zend Extension => 320170718
Zend Extension Build => API320170718,NTS
PHP Extension Build => API20170718,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => php, file, glob, data, http, ftp
Registered Stream Socket Transports => tcp, udp, unix, udg
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, convert.iconv.*

This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

............



I have tried to add to apache httpd.conf


<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

As is described here but it dindn’t work either.

You need


sudo a2enmod php7

otherwise apache will not find the php7 module.

I was just seeing that the php module was not loaded.

Doning what you say


tutatis:/etc/apache2/vhosts.d # a2enmod -l
authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap perl python reqtimeout authn_core authz_core mod_access_compat mpm_prefork php php7.2.5
tutatis:/etc/apache2/vhosts.d # a2dismod php
tutatis:/etc/apache2/vhosts.d # a2dismod php7.2.5
tutatis:/etc/apache2/vhosts.d # a2enmod php7
tutatis:/etc/apache2/vhosts.d # a2enmod -l
authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap perl python reqtimeout authn_core authz_core mod_access_compat mpm_prefork php7
tutatis:/etc/apache2/vhosts.d # apache2ctl -M
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_prefork_module (static)
 unixd_module (static)
 systemd_module (static)
 authz_host_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authz_groupfile_module (shared)
 authn_file_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 dir_module (shared)
 include_module (shared)
 log_config_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 setenvif_module (shared)
 status_module (shared)
 userdir_module (shared)
 asis_module (shared)
 imagemap_module (shared)
 reqtimeout_module (shared)
 authn_core_module (shared)
 authz_core_module (shared)
 access_compat_module (shared)
 php7_module (shared)
tutatis:/etc/apache2/vhosts.d # systemctl restart apache2


and


tutatis:/etc/apache2/vhosts.d # lsof   |grep php
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/500/gvfs
      Output information may be incomplete.
httpd-pre   461                       root  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   461                       root  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   461                       root  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   461                       root  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   461                       root  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   461                       root  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   461                       root  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   461                       root  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   461                       root  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   461                       root  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   461                       root  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   461                       root  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   461                       root  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   466                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   466                     wwwrun  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   466                     wwwrun  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   466                     wwwrun  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   466                     wwwrun  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   466                     wwwrun  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   466                     wwwrun  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   466                     wwwrun  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   466                     wwwrun  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   466                     wwwrun  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   466                     wwwrun  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   466                     wwwrun  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   466                     wwwrun  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   467                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   467                     wwwrun  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   467                     wwwrun  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   467                     wwwrun  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   467                     wwwrun  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   467                     wwwrun  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   467                     wwwrun  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   467                     wwwrun  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   467                     wwwrun  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   467                     wwwrun  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   467                     wwwrun  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   467                     wwwrun  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   467                     wwwrun  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   468                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   468                     wwwrun  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   468                     wwwrun  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   468                     wwwrun  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   468                     wwwrun  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   468                     wwwrun  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   468                     wwwrun  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   468                     wwwrun  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   468                     wwwrun  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   468                     wwwrun  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   468                     wwwrun  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   468                     wwwrun  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   468                     wwwrun  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   470                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   470                     wwwrun  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   470                     wwwrun  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   470                     wwwrun  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   470                     wwwrun  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   470                     wwwrun  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   470                     wwwrun  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   470                     wwwrun  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   470                     wwwrun  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   470                     wwwrun  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   470                     wwwrun  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   470                     wwwrun  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   470                     wwwrun  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   539                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   539                     wwwrun  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   539                     wwwrun  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   539                     wwwrun  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   539                     wwwrun  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   539                     wwwrun  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   539                     wwwrun  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   539                     wwwrun  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   539                     wwwrun  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   539                     wwwrun  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   539                     wwwrun  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   539                     wwwrun  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   539                     wwwrun  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   541                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
httpd-pre   541                     wwwrun  mem       REG                9,2     35664   99363060 /usr/lib64/php7/extensions/xmlreader.so
httpd-pre   541                     wwwrun  mem       REG                9,2     18928   99363059 /usr/lib64/php7/extensions/tokenizer.so
httpd-pre   541                     wwwrun  mem       REG                9,2     53872   99363058 /usr/lib64/php7/extensions/sqlite3.so
httpd-pre   541                     wwwrun  mem       REG                9,2     32000   99363057 /usr/lib64/php7/extensions/pdo_sqlite.so
httpd-pre   541                     wwwrun  mem       REG                9,2     31680   99363063 /usr/lib64/php7/extensions/pdo_mysql.so
httpd-pre   541                     wwwrun  mem       REG                9,2    126616   99363056 /usr/lib64/php7/extensions/pdo.so
httpd-pre   541                     wwwrun  mem       REG                9,2    134304   99363062 /usr/lib64/php7/extensions/mysqli.so
httpd-pre   541                     wwwrun  mem       REG                9,2    137864   99363054 /usr/lib64/php7/extensions/json.so
httpd-pre   541                     wwwrun  mem       REG                9,2     43912   99363053 /usr/lib64/php7/extensions/iconv.so
httpd-pre   541                     wwwrun  mem       REG                9,2    192728   99363055 /usr/lib64/php7/extensions/dom.so
httpd-pre   541                     wwwrun  mem       REG                9,2     14664   99363052 /usr/lib64/php7/extensions/ctype.so
httpd-pre   541                     wwwrun  mem       REG                9,2   9525480   99745802 /usr/lib64/apache2/mod_php7.so
httpd-pre   543                     wwwrun  mem       REG                9,2     52080   99363061 /usr/lib64/php7/extensions/xmlwriter.so
............



Now the php7_module is loaded, but it does not work either (the php file is still not processed)

Mmm. Out of ideas for the moment. Can only show you my output, I don’t have moodle installed, and it comes from my TW server:


authz_host actions alias authz_user auth_basic authn_file authz_groupfile autoindex cgi dir env expires include log_config mime negotiation setenvif userdir auth_digest headers proxy proxy_http rewrite ssl vhost_alias version authnz_external authn_core socache_shmcb authz_core php7 proxy_wstunnel reqtimeout authz_unixgroup pwauth



I’m searching for some clues in log files

This is from /var/log/apache2/access_log when accessing localhost/info.php



::1 - - [09/Sep/2019:17:40:24 +0200] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.4.33 (Linux/SUSE) PHP/7.3.9 (internal dummy connection)"
::1 - - [09/Sep/2019:17:40:26 +0200] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.4.33 (Linux/SUSE) PHP/7.3.9 (internal dummy connection)"


And this from /var/log/apache2/error_log


[Mon Sep 09 01:40:35.791554 2019] [mpm_prefork:notice] [pid 31759] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 01:40:35.867882 2019] [mpm_prefork:notice] [pid 31829] AH00163: Apache/2.4.33 (Linux/SUSE) configured -- resuming normal operations
[Mon Sep 09 01:40:35.867939 2019] [core:notice] [pid 31829] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 02:09:12.554176 2019] [mpm_prefork:notice] [pid 31829] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 02:09:12.637424 2019] [mpm_prefork:notice] [pid 32481] AH00163: Apache/2.4.33 (Linux/SUSE) configured -- resuming normal operations
[Mon Sep 09 02:09:12.637489 2019] [core:notice] [pid 32481] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 02:10:05.735853 2019] [mpm_prefork:notice] [pid 32481] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 02:10:05.791799 2019] [mpm_prefork:notice] [pid 32547] AH00163: Apache/2.4.33 (Linux/SUSE) configured -- resuming normal operations
[Mon Sep 09 02:10:05.791864 2019] [core:notice] [pid 32547] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 02:16:03.480063 2019] [mpm_prefork:notice] [pid 32547] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 02:16:03.549075 2019] [mpm_prefork:notice] [pid 461] AH00163: Apache/2.4.33 (Linux/SUSE) PHP/7.2.5 configured -- resuming normal operations
[Mon Sep 09 02:16:03.549115 2019] [core:notice] [pid 461] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 02:28:10.256087 2019] [mpm_prefork:notice] [pid 461] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 02:28:10.326182 2019] [mpm_prefork:notice] [pid 758] AH00163: Apache/2.4.33 (Linux/SUSE) PHP/7.2.5 configured -- resuming normal operations
[Mon Sep 09 02:28:10.326223 2019] [core:notice] [pid 758] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 02:28:32.077304 2019] [php7:error] [pid 763] [client 192.168.2.3:49796] script '/srv/www/htdocs/config.php' not found or unable to stat
[Mon Sep 09 02:28:37.943496 2019] [php7:error] [pid 763] [client 192.168.2.3:49796] script '/srv/www/htdocs/test.php' not found or unable to stat
[Mon Sep 09 02:33:10.820260 2019] [mpm_prefork:notice] [pid 758] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 02:33:10.890119 2019] [mpm_prefork:notice] [pid 919] AH00163: Apache/2.4.33 (Linux/SUSE) PHP/7.2.5 configured -- resuming normal operations
[Mon Sep 09 02:33:10.890166 2019] [core:notice] [pid 919] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 02:37:54.253005 2019] [mpm_prefork:notice] [pid 919] AH00170: caught SIGWINCH, shutting down gracefully





and then, after editing apache configuration with yast and reinstalling php7 … everithing goes worse. html pages stop working either, and I got this


[Mon Sep 09 17:43:25.040398 2019] [access_compat:error] [pid 8237] [client 192.168.2.3:34700] AH01797: client denied by server configuration: /srv/www/htdocs/, referer: http://192.168.2.2/
[Mon Sep 09 17:46:29.186033 2019] [mpm_prefork:notice] [pid 8126] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 09 17:46:29.287041 2019] [mpm_prefork:notice] [pid 8414] AH00163: Apache/2.4.33 (Linux/SUSE) PHP/7.3.9 configured -- resuming normal operations
[Mon Sep 09 17:46:29.287093 2019] [core:notice] [pid 8414] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D a2enflag -D MAILMAN -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Mon Sep 09 17:46:33.273358 2019] [access_compat:error] [pid 8419] [client 192.168.2.3:34722] AH01797: client denied by server configuration: /srv/www/htdocs/, referer: http://192.168.2.2/
[Mon Sep 09 17:46:35.271922 2019] [access_compat:error] [pid 8419] [client 192.168.2.3:34722] AH01797: client denied by server configuration: /srv/www/htdocs/
[Mon Sep 09 17:47:35.321876 2019] [access_compat:error] [pid 8420] [client 192.168.2.3:34726] AH01797: client denied by server configuration: /srv/www/htdocs/index.htm
[Mon Sep 09 17:47:38.804878 2019] [access_compat:error] [pid 8420] [client 192.168.2.3:34726] AH01797: client denied by server configuration: /srv/www/htdocs/index.html



Last problem was caused for changes in apache configuration files. For testing, I’m accessing the server via local ip, so apache is using ip-bsed_vhosts.conf.

Changing to this (from the template) makes the server again return web pages (but processing of php continues failing)


 <Directory /srv/www/htdocs>
   AllowOverride None

   <IfModule !mod_access_compat.c>
      Require all granted
   </IfModule>
   <IfModule mod_access_compat.c>
      Order allow,deny
      Allow from all
   </IfModule>

 </Directory>


Now, looking at

/var/log/apache2/access_log

I can see entries anytime I access html web pages on the server, but nothing when I try to access localhost/info.php

In
/var/log/apache2/error_log

I can’t see anything when accessing localhost/info.php

All my vhosts have this, without testing for presence of modules:


 <Directory /srv/www/htdocs/SUBDOMAINFOLDERHERE/>
  AllowOverride None
  Require all granted
 </Directory>

I’m going crazy

I have tried with opera

192.168.2.2/info.php

https://susepaste.org/55666560


192.168.2.3 - - [09/Sep/2019:19:06:35 +0200] "GET /info.php HTTP/1.1" 200 73601 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 OPR/58.0.3135.68"
192.168.2.3 - - [09/Sep/2019:19:06:36 +0200] "GET /favicon.ico HTTP/1.1" 200 302 "http://192.168.2.2/info.php" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 OPR/58.0.3135.68"
192.168.2.3 - - [09/Sep/2019:19:07:17 +0200] "-" 408 - "-" "-"



Processes the php and works

But with firefox it still return the “save file” dialog … and … it was the file was cached. Opening a private window in firefox and going to 192.168.2.2/info.php works well also.

But 192.168.2.2/moodle return a blank page.
So maybe now what I have is php working but moodle not working well with php

I have inherited the apache configuration from previous ones, I have the compat module activated. I think I should tidy up a little.

Solved!!

It was not an error but three

First)
When updating, some configuration files of the webserver are changed. Were I previously had


<Directory /srv/www/htdocs>
   AllowOverride None

   <IfModule !mod_access_compat.c>
      Require all granted
   </IfModule>
   <IfModule mod_access_compat.c>
      Order allow,deny
      Allow from all
   </IfModule>

 </Directory>




So access to the server is allowed, the upgrade cahnge some of them to “Requiere all denied” so it blocked the access to /srv/www/htdocs
(maybe it happened when trying to change apache configuration with YAST)

Second) php extension was not (properly) enabled in apache.
To configure it I had to run (for php5)


#a2enmod php5

o (for php7)


#a2enmod php7

You can list which modules are enabled with


#a2enmod -l

But yo need to know which modules are really running with


#apache2ctl -M

Once enabled, test it placing a file called info.php in /srv/www/htdocs


<?php

  // Show all information, defaults to INFO_ALL
  phpinfo();

?>

restart the web server


#systemctl restart apache2

And check that php is really running, browsing http://webserver/info.php

Third) Moodle only support php7 from version 3.0.1 upwards, as described here As my moodle is version 2 I needed to downgrade to php5 (Opensuse leap 15.1 uses php7 by default).

Thank to everybody

best regards.