Problem nextcloud raspberry php

Hello,
Yesterday I follow this tutorial about the installation of nextcloud on my new raspberry pi 3 under raspbian.
http://unixetc.co.uk/2016/11/20/simple-nextcloud-installation-on-raspberry-pi/

Everything worked fine, so i tried the next level by using a https connection with the following tutorial :

Activate SSL

We need to activate the Apache SSL Module.

a2enmod ssl
service apache2 reload

Clean up

I decided to remove the default config I created in the last tutorial.

This will remove the shortcut in the directory /etc/apache2/sites-enable

a2dissite default.conf

switch to the config directory

cd /etc/apache2/sites-available

and remove the config files itself

rm default.conf

Config

Let’s start clean.

We need to redirect all request on Port 80 to 443/HTTPS

nano nextcloud-redirect.conf

<VirtualHost *:80>
ServerName mycloud.domain.com
ServerAdmin webmaster@example.com

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

and we need a host config which will handle all the HTTPS Traffic

nano nextcloud.conf

 ServerAdmin ebmaster@example.com 
 ServerName mycloud.domain.com
 DocumentRoot /var/www/nextcloud

 <Directory /var/www/nextcloud/>
   Options +FollowSymlinks
   AllowOverride All

  <IfModule mod_dav.c>
    Dav off
  </IfModule>

   SetEnv HOME /var/www/nextcloud
   SetEnv HTTP_HOME /var/www/nextcloud
 </Directory>

 <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15768000; preload"
 </IfModule>

  SSLEngine on
  SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

As always we need to activate the files

a2ensite nextcloud-redirect.conf
a2ensite nextcloud.conf

The symlinks are now created automatically.

restart apache

service apache2 restart

but I destroy everything and i couldnt access my cloud neither with the https or the http now.

So i tried to delete everything I had done : apt-get autoremove --purge apache2 php5 ect… , and rm -r nextcloud.
I try to reinstall with the simpel http connexion from the first tuto but when i try to acces the http://192.168.1.1/nextcloud i have this white page :

  • @author Lukas Reschke
  • @author Morris Jobke
  • @author Robin Appelman
  • @author Thomas Müller
  • @author Vincent Petry
  • @license AGPL-3.0
  • This code is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Affero General Public License, version 3,
  • as published by the Free Software Foundation.
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details.
  • You should have received a copy of the GNU Affero General Public License, version 3,
  • along with this program. If not, see

*/

// Show warning if a PHP version below 5.4.0 is used, this has to happen here
// because base.php will already use 5.4 syntax.
if (version_compare(PHP_VERSION, ‘5.4.0’) === -1) {
echo ‘This version of Nextcloud requires at least PHP 5.4.0
’;
echo 'You are currently running ’ . PHP_VERSION . ‘. Please update your PHP version.’;
return;
}

// Show warning if PHP 7.1 is used as Nextcloud is not compatible with PHP 7.1 for now
// @see https://github.com/nextcloud/docker-ci/issues/10
if (version_compare(PHP_VERSION, ‘7.1.0’) !== -1) {
echo ‘This version of Nextcloud is not compatible with PHP 7.1.
’;
echo 'You are currently running ’ . PHP_VERSION . ‘.’;
return;
}

try {

require_once 'lib/base.php';

OC::handleRequest();

} catch(\OC\ServiceUnavailableException $ex) {
\OC::$server->getLogger()->logException($ex, [‘app’ => ‘index’]);

//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printExceptionErrorPage($ex);

} catch (\OC\HintException $ex) {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex, [‘app’ => ‘index’]);

//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);

} catch (Error $ex) {
\OC::$server->getLogger()->logException($ex, [‘app’ => ‘index’]);
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($ex);
}
.

I try to check in this forum i somebody had the trouble as me but nothing help me so I post this.

Thanks you for your time and help, its my first project and im sad to destroy everything i should made a backup of my rasp :frowning:

This looks like there is no php module active, because it’s the pure php code you see.

Did you install and activate the php module correctly?

sudo apt-get install libapache2-mod-php5
sudo a2enmod php5

If so check your apache log:

nano /var/log/apache2/error.log

Thank you for you help !
Yes I tried to install and activate the php module correctly, i used the 2 commands you told me already.
So i check in the error.log :

GNU nano 2.2.6 File: /var/log/apache2/error.log

[Thu Dec 29 19:30:35.516785 2016] [mpm_event:notice] [pid 2226:tid 1995735040] AH00489: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Thu Dec 29 19:30:35.517195 2016] [core:notice] [pid 2226:tid 1995735040] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Dec 29 19:31:32.959930 2016] [mpm_event:notice] [pid 2226:tid 1995735040] AH00491: caught SIGTERM, shutting down
[Thu Dec 29 19:31:34.197080 2016] [mpm_prefork:notice] [pid 5002] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Thu Dec 29 19:31:34.197395 2016] [core:notice] [pid 5002] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Dec 29 19:33:09.902258 2016] [mpm_prefork:notice] [pid 5002] AH00169: caught SIGTERM, shutting down
[Thu Dec 29 19:33:11.145156 2016] [mpm_prefork:notice] [pid 7450] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Thu Dec 29 19:33:11.145542 2016] [core:notice] [pid 7450] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Dec 29 19:38:38.115965 2016] [mpm_prefork:notice] [pid 7450] AH00169: caught SIGTERM, shutting down
[Thu Dec 29 19:38:43.400443 2016] [mpm_prefork:notice] [pid 665] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Thu Dec 29 19:38:43.407090 2016] [core:notice] [pid 665] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 00:46:52.763913 2016] [mpm_prefork:notice] [pid 665] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 00:46:57.262292 2016] [mpm_prefork:notice] [pid 644] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 00:46:57.267363 2016] [core:notice] [pid 644] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 00:58:52.497612 2016] [mpm_prefork:notice] [pid 644] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 01:14:53.733106 2016] [mpm_event:notice] [pid 2253:tid 1995481088] AH00489: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 01:14:53.736121 2016] [core:notice] [pid 2253:tid 1995481088] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 01:16:03.753688 2016] [mpm_event:notice] [pid 2253:tid 1995481088] AH00491: caught SIGTERM, shutting down
[Fri Dec 30 01:16:04.993201 2016] [mpm_prefork:notice] [pid 5109] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 01:16:04.993529 2016] [core:notice] [pid 5109] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 01:16:07.043141 2016] [mpm_prefork:notice] [pid 5109] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 01:16:08.493790 2016] [mpm_prefork:notice] [pid 5216] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 01:16:08.493968 2016] [core:notice] [pid 5216] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 01:18:00.439470 2016] [mpm_prefork:notice] [pid 5216] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 01:18:01.870015 2016] [mpm_prefork:notice] [pid 6457] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 01:18:01.870178 2016] [core:notice] [pid 6457] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 01:27:16.310385 2016] [mpm_prefork:notice] [pid 6457] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 01:27:17.707661 2016] [mpm_prefork:notice] [pid 6742] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 01:27:17.707858 2016] [core:notice] [pid 6742] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 02:02:47.446442 2016] [mpm_prefork:notice] [pid 6742] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 02:02:48.863446 2016] [mpm_prefork:notice] [pid 8613] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 02:02:48.863618 2016] [core:notice] [pid 8613] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Dec 30 02:16:10.967173 2016] [mpm_prefork:notice] [pid 8613] AH00169: caught SIGTERM, shutting down
[Fri Dec 30 02:16:17.764662 2016] [mpm_prefork:notice] [pid 692] AH00163: Apache/2.4.10 (Raspbian) configured – resuming normal operations
[Fri Dec 30 02:16:17.765584 2016] [core:notice] [pid 692] AH00094: Command line: ‘/usr/sbin/apache2’

On PHP, try installing the following packages:

libapache2-mod-php5 5.6.29+dfsg-0+deb8u1 armhf server-side, HTML-embedded scripting language (Apache 2 module)
php5-apcu 4.0.7-1 armhf APC User Cache for PHP 5
php5-cli 5.6.29+dfsg-0+deb8u1 armhf command-line interpreter for the php5 scripting language
php5-common 5.6.29+dfsg-0+deb8u1 armhf Common files for packages built from the php5 source
php5-curl 5.6.29+dfsg-0+deb8u1 armhf CURL module for php5
php5-fpm 5.6.29+dfsg-0+deb8u1 armhf server-side, HTML-embedded scripting language (FPM-CGI binary)
php5-gd 5.6.29+dfsg-0+deb8u1 armhf GD module for php5
php5-json 1.3.6-1 armhf JSON module for php5
php5-mysql 5.6.29+dfsg-0+deb8u1 armhf MySQL module for php5
php5-readline 5.6.29+dfsg-0+deb8u1 armhf Readline module for php5

Then enable a few apache modules:

sudo a2enmod rewrite headers env dir mime

Check your apache configs for errors:

apachectl -t

Do a restart:

sudo /etc/init.d/apache2 restart

Another thing:
Your nextcloud.conf seems to be missing the mod_ssl module.
This is just another idea on your nextcloud.conf and may or may not help:

Try setting the following line as first line in your nextcloud.conf:
<IfModule mod_ssl.c>
and the following as last line:
</IfModule>

Then go on with:
sudo a2ensite nextcloud.conf
and…
sudo service apache2 restart

Your nextcloud.conf and forwarder file should be VirtualHost Files. I recommend the instructions and config-files from the following guide: Bayton Nextcloud Ubuntu.

Thanks I’ll try but on the first hand I just try to install my php as I did before in order to have a connection in http://ipadress/nextcloud. But I have trouble.
Then sure I’ll try to enable ssl and I will create a nextcloud.conf in order to enable the connection in https.
I might delete an important packet or something linked to the php that why I cannot access to a proper nextcloud login page. I try to read that I show you on top but I don’t really get what it’d mean.
Again thank you for you help and your time you are so nice!
John.

You should first try to disable the nextcloud-redirect.conf with

sudo a2dissite nextcloud-redirect.conf

You may also just move or delete the file nextcloud-redirect.conf, but a2dissite is the correct way.

Check the steps from MichaIng:

sudo apt-get install libapache2-mod-php5

Additionaly, install the following:

sudo apt-get install php5-acpu php5-cli php5-common php5-curl php5-fpm php5-gd php5-json php5-mysql php5-readline

And check that the module is enabled:

sudo a2enmod php5

Afterwards, restart your apache and report if you still dont see a proper page and only text on http://192.168.1.1/nextcloud .

If this is not working, try the following:

sudo apt-get purge libapache2-mod-php5 php5 && sudo apt-get install libapache2-mod-php5 php5

Again, restart apache and report what you see.

Ah wait, depends on how far you are already in process? Could be good idea to first try PHP work properly before setting up all the ssl stuff. Would be easier to find the mistake/bug :wink: .

The if mod_ssl thing is not necessary for the nextcloud.conf specific part of admin manual, as long as you use it as conf or inside :80 vhost. If there is some syntax error, i.e. because of missing module, you should see some error while trying to enable the related site/conf or while restating apache.

I was reading little because of my vhost/nextcloud.conf confusion:

  • The code inside conf-enabled works for the whole server, all vhosts. So it is possible to put the code from example nextcloud.conf into conf-available and enable it
  • You could also ADD the code lines to a vhost (inside the vhost syntax), for example the standard :443 vhost to just make it work for port 443 requests. Of course this is also good idea because you anyway just want to allow ssl connection in the end. But the proper ssl configuration, strict transport security, certs etc must be configured also there, why the default :443 vhost seems a good template for me.
  • To just try getting PHP to work you could also add the nextcloud.conf lines to the standard :80 vhost (inside vhost syntax), if ssl not yet installed.

The apache error log by the way does only show your server/apache restarts, nothing problem related that I can see.

If you a2enmod php5 there is no error and apache restart also works without error in terminal?

Yeah, i was a bit overenthusiastic, you got me there :smiley: .
I guess the apt purge and reinstall of the php modules is the right way to get the php basics right in case the setup is messed up.

1 Like

OK I get what you mean. Except some php packets that I forgot (by the way you made a mistake and I assume you mean php5-apcu packet ? :slight_smile: ), nothing much happen, even if I purge and install libapach2mod. The same sentences written in php appear on my http://192.168.1.30/nextcloud :’( .

(In case I missed something here is my console, but im sorry for the size of the post …

> pi@johnteuh_pi:/etc/apache2/sites-available $ sudo a2dissite nextcloud-redirect.conf
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> 	LANGUAGE = (unset),
> 	LC_ALL = (unset),
> 	LC_PAPER = "fr_FR.UTF-8",
> 	LC_ADDRESS = "fr_FR.UTF-8",
> 	LC_MONETARY = "fr_FR.UTF-8",
> 	LC_NUMERIC = "fr_FR.UTF-8",
> 	LC_TELEPHONE = "fr_FR.UTF-8",
> 	LC_IDENTIFICATION = "fr_FR.UTF-8",
> 	LC_MEASUREMENT = "fr_FR.UTF-8",
> 	LC_TIME = "fr_FR.UTF-8",
> 	LC_NAME = "fr_FR.UTF-8",
> 	LANG = "en_US.UTF-8"
>     are supported and installed on your system.
> perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
> Site nextcloud-redirect already disabled
> pi@johnteuh_pi:/etc/apache2/sites-available $ sudo rm nextcloud-redirect.conf 
> pi@johnteuh_pi:/etc/apache2/sites-available $ sudo apt-get install libapache2-mod-php5
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> libapache2-mod-php5 is already the newest version.
> 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
> pi@johnteuh_pi:/etc/apache2/sites-available $ sudo apt-get install php5-acpu php5-cli php5-common php5-curl php5-fpm php5-gd php5-json php5-mysql php5-readline
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> E: Unable to locate package php5-acpu
> pi@johnteuh_pi:/etc/apache2/sites-available $ cd
> pi@johnteuh_pi:~ $ sudo apt-get install php5-acpu php5-cli php5-common php5-curl php5-fpm php5-gd php5-json php5-mysql php5-readline
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> E: Unable to locate package php5-acpu
> pi@johnteuh_pi:~ $ sudo apt-get install php5-apcu php5-cli php5-common php5-curl php5-fpm php5-gd php5-json php5-mysql php5-readline
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> php5-cli is already the newest version.
> php5-cli set to manually installed.
> php5-common is already the newest version.
> php5-common set to manually installed.
> php5-curl is already the newest version.
> php5-gd is already the newest version.
> php5-json is already the newest version.
> php5-mysql is already the newest version.
> php5-readline is already the newest version.
> php5-readline set to manually installed.
> The following extra packages will be installed:
>   libapparmor1
> Suggested packages:
>   php-pear
> The following NEW packages will be installed:
>   libapparmor1 php5-apcu php5-fpm
> 0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
> Need to get 2047 kB of archives.
> After this operation, 8420 kB of additional disk space will be used.
> Do you want to continue? [Y/n] y
> Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main php5-apcu armhf 4.0.7-1 [74.6 kB]
> Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libapparmor1 armhf 2.9.0-3 [58.1 kB]
> Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main php5-fpm armhf 5.6.29+dfsg-0+deb8u1 [1914 kB]
> Fetched 2047 kB in 3s (539 kB/s)    
> Can't set locale; make sure $LC_* and $LANG are correct!
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> 	LANGUAGE = (unset),
> 	LC_ALL = (unset),
> 	LC_TIME = "fr_FR.UTF-8",
> 	LC_MONETARY = "fr_FR.UTF-8",
> 	LC_ADDRESS = "fr_FR.UTF-8",
> 	LC_TELEPHONE = "fr_FR.UTF-8",
> 	LC_NAME = "fr_FR.UTF-8",
> 	LC_MEASUREMENT = "fr_FR.UTF-8",
> 	LC_IDENTIFICATION = "fr_FR.UTF-8",
> 	LC_NUMERIC = "fr_FR.UTF-8",
> 	LC_PAPER = "fr_FR.UTF-8",
> 	LANG = "en_US.UTF-8"
>     are supported and installed on your system.
> perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
> locale: Cannot set LC_ALL to default locale: No such file or directory
> Selecting previously unselected package php5-apcu.
> (Reading database ... 137993 files and directories currently installed.)
> Preparing to unpack .../php5-apcu_4.0.7-1_armhf.deb ...
> Unpacking php5-apcu (4.0.7-1) ...
> Selecting previously unselected package libapparmor1:armhf.
> Preparing to unpack .../libapparmor1_2.9.0-3_armhf.deb ...
> Unpacking libapparmor1:armhf (2.9.0-3) ...
> Selecting previously unselected package php5-fpm.
> Preparing to unpack .../php5-fpm_5.6.29+dfsg-0+deb8u1_armhf.deb ...
> Unpacking php5-fpm (5.6.29+dfsg-0+deb8u1) ...
> Processing triggers for systemd (215-17+deb8u5) ...
> Processing triggers for man-db (2.7.0.2-5) ...
> Setting up php5-apcu (4.0.7-1) ...
> php5_invoke: Enable module apcu for fpm SAPI
> php5_invoke: Enable module apcu for apache2 SAPI
> php5_invoke: Enable module apcu for cli SAPI
> Setting up libapparmor1:armhf (2.9.0-3) ...
> Setting up php5-fpm (5.6.29+dfsg-0+deb8u1) ...
> locale: Cannot set LC_ALL to default locale: No such file or directory

> Creating config file /etc/php5/fpm/php.ini with new version
> php5_invoke: Enable module json for fpm SAPI
> php5_invoke: Enable module intl for fpm SAPI
> php5_invoke: Enable module curl for fpm SAPI
> php5_invoke: Enable module opcache for fpm SAPI
> php5_invoke: Enable module mysql for fpm SAPI
> php5_invoke: Enable module gd for fpm SAPI
> php5_invoke: Enable module sqlite3 for fpm SAPI
> php5_invoke: Enable module ldap for fpm SAPI
> php5_invoke: Enable module pdo for fpm SAPI
> php5_invoke: Enable module readline for fpm SAPI
> php5_invoke: Enable module mcrypt for fpm SAPI
> php5_invoke: Enable module pdo_mysql for fpm SAPI
> php5_invoke: Enable module mysqli for fpm SAPI
> php5_invoke: Enable module pdo_sqlite for fpm SAPI
> Processing triggers for libc-bin (2.19-18+deb8u6) ...
> Processing triggers for systemd (215-17+deb8u5) ...
> pi@johnteuh_pi:~ $ sudo a2enmod php5
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> 	LANGUAGE = (unset),
> 	LC_ALL = (unset),
> 	LC_PAPER = "fr_FR.UTF-8",
> 	LC_ADDRESS = "fr_FR.UTF-8",
> 	LC_MONETARY = "fr_FR.UTF-8",
> 	LC_NUMERIC = "fr_FR.UTF-8",
> 	LC_TELEPHONE = "fr_FR.UTF-8",
> 	LC_IDENTIFICATION = "fr_FR.UTF-8",
> 	LC_MEASUREMENT = "fr_FR.UTF-8",
> 	LC_TIME = "fr_FR.UTF-8",
> 	LC_NAME = "fr_FR.UTF-8",
> 	LANG = "en_US.UTF-8"
>     are supported and installed on your system.
> perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
> Module php5 already enabled
> pi@johnteuh_pi:~ $ sudo ser
> serialver   servertool  service     
> pi@johnteuh_pi:~ $ sudo ser
> serialver   servertool  service     
> pi@johnteuh_pi:~ $ sudo service apache2 restart 
> pi@johnteuh_pi:~ $ sudo apt-get purge libapache2-mod-php5 php5 && sudo apt-get install libapache2-mod-php5 php5
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> The following packages will be REMOVED:
>   libapache2-mod-php5* php5*
> 0 upgraded, 0 newly installed, 2 to remove and 2 not upgraded.
> After this operation, 8264 kB disk space will be freed.
> Do you want to continue? [Y/n] y
> Can't set locale; make sure $LC_* and $LANG are correct!
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> 	LANGUAGE = (unset),
> 	LC_ALL = (unset),
> 	LC_TIME = "fr_FR.UTF-8",
> 	LC_MONETARY = "fr_FR.UTF-8",
> 	LC_ADDRESS = "fr_FR.UTF-8",
> 	LC_TELEPHONE = "fr_FR.UTF-8",
> 	LC_NAME = "fr_FR.UTF-8",
> 	LC_MEASUREMENT = "fr_FR.UTF-8",
> 	LC_IDENTIFICATION = "fr_FR.UTF-8",
> 	LC_NUMERIC = "fr_FR.UTF-8",
> 	LC_PAPER = "fr_FR.UTF-8",
> 	LANG = "en_US.UTF-8"
>     are supported and installed on your system.
> perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
> locale: Cannot set LC_ALL to default locale: No such file or directory
> (Reading database ... 138044 files and directories currently installed.)
> Removing php5 (5.6.29+dfsg-0+deb8u1) ...
> Removing libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...
> php5_invoke prerm: Disable module json for apache2 SAPI
> php5_invoke prerm: Disable module intl for apache2 SAPI
> php5_invoke prerm: Disable module apcu for apache2 SAPI
> php5_invoke prerm: Disable module opcache for apache2 SAPI
> php5_invoke prerm: Disable module mysql for apache2 SAPI
> php5_invoke prerm: Disable module ldap for apache2 SAPI
> php5_invoke prerm: Disable module pdo for apache2 SAPI
> php5_invoke prerm: Disable module readline for apache2 SAPI
> php5_invoke prerm: Disable module mcrypt for apache2 SAPI
> php5_invoke prerm: Disable module pdo_mysql for apache2 SAPI
> php5_invoke prerm: Disable module mysqli for apache2 SAPI
> Module php5 disabled.
> apache2_invoke prerm: Disable module php5
> Purging configuration files for libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...
> apache2_invoke postrm: Purging state for php5
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> Suggested packages:
>   php-pear
> The following NEW packages will be installed:
>   libapache2-mod-php5 php5
> 0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
> Need to get 0 B/1881 kB of archives.
> After this operation, 8264 kB of additional disk space will be used.
> Can't set locale; make sure $LC_* and $LANG are correct!
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> 	LANGUAGE = (unset),
> 	LC_ALL = (unset),
> 	LC_TIME = "fr_FR.UTF-8",
> 	LC_MONETARY = "fr_FR.UTF-8",
> 	LC_ADDRESS = "fr_FR.UTF-8",
> 	LC_TELEPHONE = "fr_FR.UTF-8",
> 	LC_NAME = "fr_FR.UTF-8",
> 	LC_MEASUREMENT = "fr_FR.UTF-8",
> 	LC_IDENTIFICATION = "fr_FR.UTF-8",
> 	LC_NUMERIC = "fr_FR.UTF-8",
> 	LC_PAPER = "fr_FR.UTF-8",
> 	LANG = "en_US.UTF-8"
>     are supported and installed on your system.
> perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
> locale: Cannot set LC_ALL to default locale: No such file or directory
> Selecting previously unselected package libapache2-mod-php5.
> (Reading database ... 138029 files and directories currently installed.)
> Preparing to unpack .../libapache2-mod-php5_5.6.29+dfsg-0+deb8u1_armhf.deb ...
> Unpacking libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...
> Selecting previously unselected package php5.
> Preparing to unpack .../php5_5.6.29+dfsg-0+deb8u1_all.deb ...
> Unpacking php5 (5.6.29+dfsg-0+deb8u1) ...
> Setting up libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...
> locale: Cannot set LC_ALL to default locale: No such file or directory

> Creating config file /etc/php5/apache2/php.ini with new version
> php5_invoke: Enable module json for apache2 SAPI
> php5_invoke: Enable module intl for apache2 SAPI
> php5_invoke: Enable module curl for apache2 SAPI
> php5_invoke: Enable module apcu for apache2 SAPI
> php5_invoke: Enable module opcache for apache2 SAPI
> php5_invoke: Enable module mysql for apache2 SAPI
> php5_invoke: Enable module gd for apache2 SAPI
> php5_invoke: Enable module sqlite3 for apache2 SAPI
> php5_invoke: Enable module ldap for apache2 SAPI
> php5_invoke: Enable module pdo for apache2 SAPI
> php5_invoke: Enable module readline for apache2 SAPI
> php5_invoke: Enable module mcrypt for apache2 SAPI
> php5_invoke: Enable module pdo_mysql for apache2 SAPI
> php5_invoke: Enable module mysqli for apache2 SAPI
> php5_invoke: Enable module pdo_sqlite for apache2 SAPI
> apache2_invoke: Enable module php5
> Setting up php5 (5.6.29+dfsg-0+deb8u1) ...
> pi@johnteuh_pi:~ $ sudo service apache2 restart pi@johnteuh_pi:~ $ sudo reboot 
> Connection to 192.168.1.30 closed by remote host.
> Connection to 192.168.1.30 closed.
> gary@gary-N53SN:~$ ssh pi@192.168.1.30 -p 1410
> pi@192.168.1.30's password: 

> The programs included with the Debian GNU/Linux system are free software;
> the exact distribution terms for each program are described in the
> individual files in /usr/share/doc/*/copyright.

> Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
> permitted by applicable law.
> Last login: Sat Dec 31 00:54:56 2016

OK i’ll try to install everything (I already did with this command before sudo apt-get install php5-acpu php5-cli php5-common php5-curl php5-fpm php5-gd php5-json php5-mysql php5-readline)

Nothing much change :cry:

Here is my console :

pi@johnteuh_pi:~ $ sudo apt-get install libapache2-mod-php5 5.6.29+dfsg-0+deb8u1 armhf server-side
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package 5.6.29+dfsg-0+deb8u1
E: Couldn't find any package by regex '5.6.29+dfsg-0+deb8u1'
E: Unable to locate package armhf
E: Unable to locate package server-side
pi@johnteuh_pi:~ $ sudo apt-get install php5-apcu 4.0.7-1 armhf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package 4.0.7-1
E: Couldn't find any package by regex '4.0.7-1'
E: Unable to locate package armhf
pi@johnteuh_pi:~ $ sudo a2enmod rewrite headers env dir mime
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_PAPER = "fr_FR.UTF-8",
	LC_ADDRESS = "fr_FR.UTF-8",
	LC_MONETARY = "fr_FR.UTF-8",
	LC_NUMERIC = "fr_FR.UTF-8",
	LC_TELEPHONE = "fr_FR.UTF-8",
	LC_IDENTIFICATION = "fr_FR.UTF-8",
	LC_MEASUREMENT = "fr_FR.UTF-8",
	LC_TIME = "fr_FR.UTF-8",
	LC_NAME = "fr_FR.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Enabling module rewrite.
Enabling module headers.
Module env already enabled
Module dir already enabled
Module mime already enabled
To activate the new configuration, you need to run:
  service apache2 restart
pi@johnteuh_pi:~ $ apachectl -t
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
pi@johnteuh_pi:~ $ sudo /etc/init.d/apache2 restart
[....] Restarting apache2 (via systemctl): apache2.serviceWarning: Unit file of apache2.service changed on disk, 'systemctl daemon-reload' recommended.
. ok
MichaIng,

Because I just try to reinstall properly my server and I already have some trouble to print a http page, I delete the nextcloud.conf and I have on /etc/apache2/sites-available , the file default-ssl.conf with inside :
> IfModule mod_ssl.c>
>
> ServerAdmin webmaster@localhost

>                 DocumentRoot /var/www/html
> etc etc ...

but because I disable the ssl connection if I understand this file doesnt interact to the fact that my website http://192.168.1.30/nextcloud give me a pure php code ? (because the first step is to get a fine http page before enable the ssl and try to go for an https connection) But I installed everything you told me, I think I delete and deassign everything correctly so I’m kind of lost … So much trouble for something I made quickly some days ago, and so much trouble for the http part …

And again that you for you time and your investigation you realy made my day !
I’m here if you have some others advice.

for the :
“If you a2enmod php5 there is no error and apache restart also works without error in terminal?”

There is what happen in my terminal (I dont know what I change because now the apache2 restart say something and Im pretty sure that it was silent before)

pi@johnteuh_pi:~ $ sudo a2enmod php5
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = “fr_FR.UTF-8”,
LC_ADDRESS = “fr_FR.UTF-8”,
LC_MONETARY = “fr_FR.UTF-8”,
LC_NUMERIC = “fr_FR.UTF-8”,
LC_TELEPHONE = “fr_FR.UTF-8”,
LC_IDENTIFICATION = “fr_FR.UTF-8”,
LC_MEASUREMENT = “fr_FR.UTF-8”,
LC_TIME = “fr_FR.UTF-8”,
LC_NAME = “fr_FR.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
Module php5 already enabled
pi@johnteuh_pi:~ $ sudo ser
serialver servertool service
pi@johnteuh_pi:~ $ sudo service apache2 restart
Warning: Unit file of apache2.service changed on disk, ‘systemctl daemon-reload’ recommended.

Therefore this system is smart enough and put’s the long code inside a scrollable box :smiley: .

So according to your console mod_php is definitely up and apache restarts without error.

According to the admin manual the necessary apache modules are enabled and also the php modules (at the beginning of the linked manual page) and you created the nextcloud.conf as described and a2ensite nextcloud without error?

(By the way they really mean to create a new file and add just these lines, different than I said before. I guess the :80 and in case :443 vhosts need to be still there configured and active to make web access through the related ports possible. As I said I also made a separate nextcloud.conf, but inside conf-available and a2enconf nextcloud which also works perfectly. Maybe someone has to explain me the differences between conf and sites then and why you should use which for what. But that’s a different topic :wink: .)

As I see at the beginning of your console you also installed php5-fpm? As far as I know fpm is a separate way to process php files, different than via mod_php (libapache2-mod-php5). I don’t know how to configure or how one method is chosen, if both are available, but you could try to purge php5_fpm. Maybe the install procedure with this mod causes some problems for mod_php to work:

Ah sorry, too long break while answering :smiley: .

So ongoing: There is no “000-default.conf” beside the ssl.conf in your sites-available? Because the “<VirtualHost default:443>” in default-ssl.conf makes it only react on access through port 443, so via https (and active ssl configuration), not via http. Ah “If Module mod_ssl.c>” is in the front, so it will do absolutely nothing without mod_ssl enabled :stuck_out_tongue: .

In case here is mine with the redirection part removed. Should work for you also, as our systems are nearly the same:

<VirtualHost *:80>
        ServerName your.domain.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ErrorLog ${APACHE_LOG_DIR}/error.log

RewriteEngine on
RewriteCond %{SERVER_NAME} =your.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

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

Then the nextcloud.conf from admin manual beside + enabled as well and try to purge php_fpm as I mentioned before.

You can do “systemctl daemon-reload” as mentioned in console too, as I remember this always appears after changing something at apache configuration.

you created the nextcloud.conf as described and a2ensite nextcloud without error?

Yes,but a change few things because my raspberry is on the port 1410 not 80, and I moved my nextcloud to /var/nextcloud, instead of /var/www/html/nextcloud. Am I right ?

  • On sites-available i have 3 files now : 000 default .conf , defaultssl.conf , nextcloud . conf
    I didnt touch the default ssl and here is my 000default and nextcloud files :

000default :

<VirtualHost *:1410>
        # The ServerName directive sets the request scheme, hostname and port t$
        # 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
        ServerAdmin webmaster@localhost
        DocumentRoot /var
        # 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

here is my nextcloud.conf

Alias /nextcloud "/var/nextcloud/"
<Directory /var/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All
 <IfModule mod_dav.c>
  Dav off
 </IfModule>
 SetEnv HOME /var/nextcloud
 SetEnv HTTP_HOME /var/nextcloud
</Directory>

I don’t understand what you mean with the default-ssl should I change the port to 1410 instead of 443 because it will disable my connection to http ?
and I don’t get which file I need to modify in the directory sites-enable, because right now I didnt change anything

Then,
I purge the php5_fpm.

I made a systemctl daemon-reload

I restart apache2

Even with that I still have this message on my http://192.168.1.30/nextcloud

* @author Lukas Reschke * @author Morris Jobke * @author Robin Appelman * @author Thomas Müller * @author Vincent Petry * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see * */ // Show warning if a PHP version below 5.4.0 is used, this has to happen here // because base.php will already use 5.4 syntax. if (version_compare(PHP_VERSION, '5.4.0') === -1) { echo 'This version of Nextcloud requires at least PHP 5.4.0
'; echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; return; } // Show warning if PHP 7.1 is used as Nextcloud is not compatible with PHP 7.1 for now // @see https://github.com/nextcloud/docker-ci/issues/10 if (version_compare(PHP_VERSION, '7.1.0') !== -1) { echo 'This version of Nextcloud is not compatible with PHP 7.1.
'; echo 'You are currently running ' . PHP_VERSION . '.'; return; } try { require_once 'lib/base.php'; OC::handleRequest(); } catch(\OC\ServiceUnavailableException $ex) { \OC::$server->getLogger()->logException($ex, ['app' => 'index']); //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Template::printExceptionErrorPage($ex); } catch (\OC\HintException $ex) { OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); } catch (Exception $ex) { \OC::$server->getLogger()->logException($ex, ['app' => 'index']); //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); OC_Template::printExceptionErrorPage($ex); } catch (Error $ex) { \OC::$server->getLogger()->logException($ex, ['app' => 'index']); OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); OC_Template::printExceptionErrorPage($ex); } 

PS : and because I’ve change my nextcloud data directory I change the config.php file and the line datadirectory to the right one (/var/nextcloud/data instead of /var/www/html/nextcloud/data) , but I dont think that was link to my php problem on my http page.

Many thanks for you help, thanking you in advance.
John

Hello, I try something new,
I’d follow this tutorial in order to check if apache2, php5 and msql were right installed.

What I can say is that apache and msql is well installed and I have kind of the same array for the php5 info so I dont understand why I can’t access to my http://192.168.1.30/nextcloud. On my computer (raspberry is connected via ssh) I I still have the problem of pure php code. Do i have to update something on my computer? (its wierd 'cause as I told you I was able to login this page some days ago before I fucked up everything … )

Then, directly from my raspberry I dont have such a php code just a problem of port cause he told me I dont have the permission to go through the port 80, (sure because my raspberry is on the 1410). What I have to do to change that ? in the nextcloud conf? I already change the port 80 to 1410 but I must missing something.

Thanks a lot for your attention !
John.

Hi

please try

Maybe firewall → install apt-get install namp

check which services are activated: nmap localhost

80/tcp open http
443/tcp open https

or in your case: nmap localhost -p 1410

firewall rules:
iptables help: How To Set Up a Firewall Using Iptables on Ubuntu 14.04 | DigitalOcean

→ only if it enabled


check /etc/apache2/ports.conf

Are there all ports that you need?


check config.php in directory nextcloud/config
array (
0 => ‘192.168.1.30’,
),