Your webserver seems to be not configured to use PHP or PHP is not installed

Issue,

I had installed Pi-hole/lighttpd and then Nextcloud/Apache2 and then attempted to update the ports that lighttpd used so that they did not conflict with Apache.

Strangely, Nextcloud wouldn’t work unless I accessed it from the new port in lighttpd :frowning:

I then reverted back the change, and configured apache/nextcloud to use port 8080. But when I access Nextcloud via the new port, I receive this error:

 * Your webserver seems to be not configured to use PHP or PHP is not installed.
* Please contact your administrator or follow our documentation:
* https://docs.nextcloud.com/server/15/admin_manual/installation/source_installation.html

I’ve read that it could be a port conflict, but as you can see in the below extract of my ports, Apache and Lighttpd are using different ports.

Apache and Lighttpd were installed on a clean image of Raspbian/buster, so I don’t believe there were any previous versions of PHP.

Could someone please point me in the right direction on how to get Apache working with PHP.

============================================================

Nextcloud version

  • installed: true
  • version: 16.0.3.0
  • versionstring: 16.0.3
  • edition:

Operating system and version
Linux 4.19.58-v7+ armv7l / Raspbian Buster

APACHE version
Server version: Apache/2.4.38 (Raspbian)
Server built: 2019-04-07T18:15:40

PHP version
PHP 7.3.4-2 (cli) (built: Apr 13 2019 19:05:48) ( NTS )

PHP Modules
apc
apcu
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache

Ports.config
Listen 0.0.0.0:8080

Listen 0.0.0.0:443


Listen 0.0.0.0:443

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Ports in use

sudo lsof -i -P -n | grep LISTEN

systemd      1        root   48u  IPv6  10897      0t0  TCP *:6600 (LISTEN)
mpd        573         mpd    4u  IPv6  10897      0t0  TCP *:6600 (LISTEN)
mpd        573         mpd   16u  IPv6  26053      0t0  TCP *:8000 (LISTEN)
cloudflar  581        root    3u  IPv4  18164      0t0  TCP 127.0.0.1:43241 (LISTEN)
cloudflar  581        root    6u  IPv4  18170      0t0  TCP 127.0.0.1:54 (LISTEN)
vncserver  625        root    9u  IPv6  20594      0t0  TCP *:5900 (LISTEN)
vncserver  625        root   10u  IPv4  20595      0t0  TCP *:5900 (LISTEN)
sshd       897        root    3u  IPv4  16893      0t0  TCP *:22 (LISTEN)
sshd       897        root    4u  IPv6  16895      0t0  TCP *:22 (LISTEN)

redis-ser  925       redis    6u  IPv4  14280      0t0  TCP 127.0.0.1:6379 (LISTEN)
redis-ser  925       redis    7u  IPv6  14281      0t0  TCP [::1]:6379 (LISTEN)

exim4      970 Debian-exim    3u  IPv4  17714      0t0  TCP 127.0.0.1:25 (LISTEN)
exim4      970 Debian-exim    4u  IPv6  17715      0t0  TCP [::1]:25 (LISTEN)


lighttpd  1115    www-data    4u  IPv4  19680      0t0  TCP *:80 (LISTEN)
lighttpd  1115    www-data    5u  IPv6  19681      0t0  TCP *:80 (LISTEN)
lighttpd  1115    www-data    6u  IPv4  19682      0t0  TCP *:443 (LISTEN)

smbd      1193        root   32u  IPv6  19948      0t0  TCP *:445 (LISTEN)
smbd      1193        root   33u  IPv6  19949      0t0  TCP *:139 (LISTEN)
smbd      1193        root   34u  IPv4  19950      0t0  TCP *:445 (LISTEN)
smbd      1193        root   35u  IPv4  19951      0t0  TCP *:139 (LISTEN)

pihole-FT 1393      pihole    5u  IPv4  19378      0t0  TCP *:53 (LISTEN)
pihole-FT 1393      pihole    7u  IPv6  19380      0t0  TCP *:53 (LISTEN)
pihole-FT 1393      pihole   10u  IPv4  20175      0t0  TCP 127.0.0.1:4711 (LISTEN)
pihole-FT 1393      pihole   11u  IPv6  20178      0t0  TCP [::1]:4711 (LISTEN)

apache2   2191        root    3u  IPv4  26607      0t0  TCP *:8080 (LISTEN)
apache2   2192    www-data    3u  IPv4  26607      0t0  TCP *:8080 (LISTEN)
apache2   2193    www-data    3u  IPv4  26607      0t0  TCP *:8080 (LISTEN)

php.config

<?php
$CONFIG = array (

  'instanceid' => 'octest.caseuyw',

  'passwordsalt' => 'pR2VOlZtest.casesdX4Gov1v',

  'secret' => 'J0dk01+NUkSSN2qtpyHvNdMQ/1OzSuSe1l4rt54keDnjHFh3',

  'trusted_domains' =>
  array (
    0 => '192.168.0.2',
    1 => '[test.case.com](http://test.case.com/)',
    2 => 'autobot',
    3 => 'localhost',
   
  ),
  'datadirectory' => '/var/nextcloud/data',
  'dbtype' => 'sqlite3',
  'version' => '16.0.3.0',
  'overwrite.cli.url' => 'http://test.case.com/nextcloud',
  'installed' => true,
'memcache.local' => '\OC\Memcache\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
),
);

Virtual Host

etc/apache2/sites-available# cat 000-default.conf

<VirtualHost *:80>

        # The ServerName directive sets the request scheme, hostname and port that

        # the server uses to identify itself. This is used when creating

        # redirection URLs. In the context of virtual hosts, the ServerName

        # specifies what hostname must appear in the request's Host: header to

        # match this virtual host. For the default virtual host (this file) this

        # value is not decisive as it is used as a last resort host regardless.

        # However, you must set it for any further virtual host explicitly.

        #ServerName [www.example.com](http://www.example.com/)

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,

        # error, crit, alert, emerg.

        # It is also possible to configure the loglevel for particular

        # modules, e.g.

        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are

        # enabled or disabled at a global level, it is possible to

        # include a line for only one particular virtual host. For example the

        # following line enables the CGI configuration for this host only

        # after it has been globally disabled with "a2disconf".

        #Include conf-available/serve-cgi-bin.conf

</VirtualHost>

<VirtualHost *:8080>

        # The ServerName directive sets the request scheme, hostname and port that

        # the server uses to identify itself. This is used when creating

        # redirection URLs. In the context of virtual hosts, the ServerName

        # specifies what hostname must appear in the request's Host: header to

        # match this virtual host. For the default virtual host (this file) this

        # value is not decisive as it is used as a last resort host regardless.

        # However, you must set it for any further virtual host explicitly.

        ServerName [test.case.com](http://test.case.com/)

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html/nextcloud/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,

        # error, crit, alert, emerg.

        # It is also possible to configure the loglevel for particular

        # modules, e.g.

        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are

        # enabled or disabled at a global level, it is possible to

        # include a line for only one particular virtual host. For example the

        # following line enables the CGI configuration for this host only

        # after it has been globally disabled with "a2disconf".

        #Include conf-available/serve-cgi-bin.conf

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

==============================

Hi Kit2,

I have, almost to a “T” the exact same setup, same clean install and same programs running, great minds. Unfortunately same issues, did you ever figure it out?

Hi Kit2,

Incase you are still working on this, here is the solution that worked for me.

For whatever reason, I cannot get pihole to work on anything other than port 80, even though I really want apache on that port, and need port 80 open to configure ssl with lets encrypt.

I ended up temporarliy switching pihole/lighttpd to any port (I used 81) and then configuring ssl.

Once this was done I put pihole/lighttpd back on port 80, and apache on port 81. To make apache work cleanly and not open my pihole up to the web I forwarded external port 80 to internal port 81 on my router.

Hope this helps!

Hi Chris,

Yes, I managed to get this working by essentially moving over Pihole into the Apache virtual directory, adding it as an available sight, and then removing lighttpd.

I hope that helps,

Sumit

how about just installing pihole without server at all and rely on commands?