Score:1

install apache2 php module

br flag

My installation of apache2 is messed up. I can't get apache2's php module installed. How can I get Apache2's php module installed?

What I have tried:

$ sudo apt reinstall libapache2-mod-php
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.11.0-44-generic linux-hwe-5.11-headers-5.11.0-44 linux-image-5.11.0-44-generic
  linux-modules-5.11.0-44-generic linux-modules-extra-5.11.0-44-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 3 not upgraded.
Need to get 2.836 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://aw.archive.ubuntu.com/ubuntu focal/main amd64 libapache2-mod-php all 2:7.4+75 [2.836 B]
Fetched 2.836 B in 1s (4.938 B/s)             
dpkg: warning: files list file for package 'firefox-mozilla-build' missing; assuming package has no files 
currently installed
(Reading database ... 333225 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-php_2%3a7.4+75_all.deb ...
Unpacking libapache2-mod-php (2:7.4+75) over (2:7.4+75) ...
Setting up libapache2-mod-php (2:7.4+75) ...

and

$ sudo apt purge libapache2-mod-php
$ sudo apt install libapache2-mod-php

The module is not installed:

$ ls /etc/apache2/mods-available
access_compat.load    cgi.load                  log_debug.load       ratelimit.load
actions.conf          charset_lite.load         log_forensic.load    reflector.load
actions.load          data.load                 lua.load             remoteip.load
alias.conf            dav_fs.conf               macro.load           reqtimeout.conf
alias.load            dav_fs.load               md.load              reqtimeout.load
allowmethods.load     dav.load                  mime.conf            request.load
asis.load             dav_lock.load             mime.load            rewrite.load
auth_basic.load       dbd.load                  mime_magic.conf      sed.load
auth_digest.load      deflate.conf              mime_magic.load      session_cookie.load
auth_form.load        deflate.load              mpm_event.conf       session_crypto.load
authn_anon.load       dialup.load               mpm_event.load       session_dbd.load
authn_core.load       dir.conf                  mpm_prefork.conf     session.load
authn_dbd.load        dir.load                  mpm_prefork.load     setenvif.conf
authn_dbm.load        dump_io.load              mpm_worker.conf      setenvif.load
authn_file.load       echo.load                 mpm_worker.load      slotmem_plain.load
authn_socache.load    env.load                  negotiation.conf     slotmem_shm.load
authnz_fcgi.load      expires.load              negotiation.load     socache_dbm.load
authnz_ldap.load      ext_filter.load           proxy_ajp.load       socache_memcache.load
authz_core.load       file_cache.load           proxy_balancer.conf  socache_redis.load
authz_dbd.load        filter.load               proxy_balancer.load  socache_shmcb.load
authz_dbm.load        headers.load              proxy.conf           speling.load
authz_groupfile.load  heartbeat.load            proxy_connect.load   ssl.conf
authz_host.load       heartmonitor.load         proxy_express.load   ssl.load
authz_owner.load      http2.conf                proxy_fcgi.load      status.conf
authz_user.load       http2.load                proxy_fdpass.load    status.load
autoindex.conf        ident.load                proxy_ftp.conf       substitute.load
autoindex.load        imagemap.load             proxy_ftp.load       suexec.load
brotli.load           include.load              proxy_hcheck.load    unique_id.load
buffer.load           info.conf                 proxy_html.conf      userdir.conf
cache_disk.conf       info.load                 proxy_html.load      userdir.load
cache_disk.load       lbmethod_bybusyness.load  proxy_http2.load     usertrack.load
cache.load            lbmethod_byrequests.load  proxy_http.load      vhost_alias.load
cache_socache.load    lbmethod_bytraffic.load   proxy.load           xml2enc.load
cern_meta.load        lbmethod_heartbeat.load   proxy_scgi.load
cgid.conf             ldap.conf                 proxy_uwsgi.load
cgid.load             ldap.load                 proxy_wstunnel.load
jasmines avatar
us flag
it's not a conf
in flag
You may see something of value either in `/var/log/apt/term.log` or in `/var/log/syslog` to explain why the package is not being properly installed
Winston de Greef avatar
br flag
@matigo I looked in those log files and saw nothing that could help. In `/var/log/apt/term.log` only a warning: `files list file for package 'firefox-mozilla-build' missing`. In `/var/log/syslog` way too many errors for lutris not being able to parse envirement variables.
Score:0
gt flag

For me, libapache2-mod-php was not enabling the php version installed, for some reason.

So I had to run a2enmod and saw I had available. In my case, I had these:
php7.0 php7.2 php7.3 php7.4 php8.0 php8.1

I double-checked with the one installed apt list php | grep installed. In my case, I have:
php/focal,focal,now 2:8.1+92+ubuntu20.04.1+deb.sury.org+2 all [installed]

Which means, I have version 8.1 (with ubuntu patches but that's irrelevant for this).

So I just had to run a2enmod php8.1 and problem solved!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.