1

I am having trouble getting PHP to be executed instead of treated like plain text.

I'm on a new Debian 10 development server, and have installed e.g. apache2 and libapache2-mod-php, which installed libapache2-mod-php7.3, but a2enmod is not finding a PHP module to execute. /etc/apache2/mods-available has:

access_compat.load    dir.conf          proxy_express.load
actions.conf          dir.load          proxy_fcgi.load
actions.load          dump_io.load      proxy_fdpass.load
alias.conf        echo.load         proxy_ftp.conf
alias.load        env.load          proxy_ftp.load
allowmethods.load     expires.load      proxy_hcheck.load
asis.load         ext_filter.load       proxy_html.conf
auth_basic.load       file_cache.load       proxy_html.load
auth_digest.load      filter.load       proxy_http2.load
auth_form.load        headers.load      proxy_http.load
authn_anon.load       heartbeat.load        proxy.load
authn_core.load       heartmonitor.load     proxy_scgi.load
authn_dbd.load        http2.conf        proxy_uwsgi.load
authn_dbm.load        http2.load        proxy_wstunnel.load
authn_file.load       ident.load        ratelimit.load
authn_socache.load    imagemap.load     reflector.load
authnz_fcgi.load      include.load      remoteip.load
authnz_ldap.load      info.conf         reqtimeout.conf
authz_core.load       info.load         reqtimeout.load
authz_dbd.load        lbmethod_bybusyness.load  request.load
authz_dbm.load        lbmethod_byrequests.load  rewrite.load
authz_groupfile.load  lbmethod_bytraffic.load   sed.load
authz_host.load       lbmethod_heartbeat.load   session_cookie.load
authz_owner.load      ldap.conf         session_crypto.load
authz_user.load       ldap.load         session_dbd.load
autoindex.conf        log_debug.load        session.load
autoindex.load        log_forensic.load     setenvif.conf
brotli.load       lua.load          setenvif.load
buffer.load       macro.load        slotmem_plain.load
cache_disk.conf       md.load           slotmem_shm.load
cache_disk.load       mime.conf         socache_dbm.load
cache.load        mime.load         socache_memcache.load
cache_socache.load    mime_magic.conf       socache_shmcb.load
cern_meta.load        mime_magic.load       speling.load
cgid.conf         mpm_event.conf        ssl.conf
cgid.load         mpm_event.load        ssl.load
cgi.load          mpm_prefork.conf      status.conf
charset_lite.load     mpm_prefork.load      status.load
data.load         mpm_worker.conf       substitute.load
dav_fs.conf       mpm_worker.load       suexec.load
dav_fs.load       negotiation.conf      unique_id.load
dav.load          negotiation.load      userdir.conf
dav_lock.load         proxy_ajp.load        userdir.load
dbd.load          proxy_balancer.conf   usertrack.load
deflate.conf          proxy_balancer.load   vhost_alias.load
deflate.load          proxy.conf        xml2enc.load
dialup.load       proxy_connect.load

PHP does not appear to me to be listed.

Are there other steps besides installing Apache, PHP, and the Apache PHP library to be able to a2enmod PHP?

Thanks,

0
0

Did you run the following commands after you checked Apache worked?

  • sudo apt update
  • sudo apt install php libapache2-mod-php

And did you restart Apache after the install?

  • sudo systemctl restart apache2

This was all I had to do to make it work on Debian 10.

Test

Put a file named index.php in your server web-root. It should contain this:

<?php
phpinfo();
?>

Then open a web browser and point it to your server.

If php works you should now see a whole lot more than what you put in the file.

3
  • Thank you; yes, I did. mods-available still has no matches for *php*. – Christos Hayward Jul 15 '20 at 13:46
  • What version of php is installed, and which version of libapache2-mod-php? Do a php --version on the command line. – svin83 Jul 16 '20 at 3:33
  • 1
    Please check that libapache2-mod-php is really installed. Files in mods-available are provided by this package, you can check it with apt-file search /etc/apache2/mods-available/php* Please post list of installed PHP related packages apt list --installed | grep php – Weisskopf Jul 16 '20 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.