I've made a slight mistake in my .htaccess and now i cannot access my page anymore

364 views Asked by At

To be more specific, i changed my php_value memory_limit accidently to 20GB while i was changing the maximum upload and post sizes. I changed it back to what it was 512MB but my page is still giving me a HTTP ERROR 500.

Anyone got any ideas what i'm missing?

This is my .htaccess

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Robots-Tag "none"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-Download-Options "noopen"
    Header set X-Permitted-Cross-Domain-Policies "none"
    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for CSS and JS files
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=7200, public"
  </FilesMatch>
</IfModule>
<IfModule mod_php5.c>
  php_value upload_max_filesize 5G
  php_value post_max_size 5G
  php_value memory_limit 512MB
  php_value mbstring.func_overload 0
  php_value always_populate_raw_post_data -1
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_php7.c>
  php_value upload_max_filesize 5G
  php_value post_max_size 5G
  php_value memory_limit 512MB
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*

This is my error log

[Sun Sep 10 16:37:08.095999 2017] [proxy_fcgi:error] [pid 634:tid 1974465584] [client 212.238.239.196:56997] AH01071: Got error 'PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 65536 bytes) in /var/www/nextcloud/lib/composer/composer/ClassLoader.php on line 412\n'
[Sun Sep 10 16:38:14.788907 2017] [mpm_event:notice] [pid 632:tid 1995735040] AH00491: caught SIGTERM, shutting down
[Sun Sep 10 16:38:15.055829 2017] [ssl:warn] [pid 1218:tid 1995862016] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 10 16:38:15.153908 2017] [ssl:warn] [pid 1219:tid 1995862016] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 10 16:38:15.159375 2017] [mpm_event:notice] [pid 1219:tid 1995862016] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2l configured -- resuming normal operations
[Sun Sep 10 16:38:15.159570 2017] [core:notice] [pid 1219:tid 1995862016] AH00094: Command line: '/usr/sbin/apache2'
[Sun Sep 10 16:38:16.044752 2017] [proxy_fcgi:error] [pid 1223:tid 1974465584] [client 212.238.239.196:57043] AH01071: Got error 'PHP message: PHP Fatal error:  **Allowed memory size of 2097152 bytes exhausted (tried to allocate 65536 bytes)** in /var/www/nextcloud/lib/composer/composer/ClassLoader.php on line 412\n'

Any help would be appreciated to the max

2

There are 2 answers

0
LEDfan On

Your htaccess file is invalid. You are starting the directive <IfModule mod_rewrite.c> but never closing it using </IfModule>.

I would advice to download the default htaccess file shipped by nextcloud and try again. Just download the zip file from here: https://nextcloud.com/install/#instructions-server and replace the htacess file.

2
Bananaapple On

The htaccess settings are only used for PHP executed within that folder or sub folders - What is the difference between php.ini and .htaccess?

Looking at the error message (Allowed memory size of 2097152 bytes exhausted) suggests that composer has a much lower memory limit than what you set so my guess would be that it is not affected by your htaccess.

Try setting the limit in your php.ini file instead.