11

I followed the Magento dev docs per below:

If you add a new .html template, and then edit it, the changes will not apply until you do the following: delete all files in the pub/static/frontend and var/view_preprocessing directories, then reload the pages. You can delete the files manually or run the grunt clean: command in CLI. For details about using Grunt in Magento see Installing and configuring Grunt.

However now in developer mode set via htaccess I get Internal Server Error 500 across site and admin urls. Is that a caching issue if its looking for the cleared files to render?

2
  • 3
    check your error log.
    – MagenX
    Commented Feb 9, 2016 at 8:41
  • 1
    internal server 500 comes due to file permission, just give 755 to folder and 644 to file
    – Alam Zaib
    Commented Apr 21, 2019 at 9:49

13 Answers 13

14

in developer mode the files are automatically generated when requested and not found. So this should not be a Problem.

When facing a 500 error the first thing you should do is search for your webserver error log.

When running on apache it can mostly be found in one of these 2 locations:

/var/log/httpd/ -> centos, archlinux ...

/var/log/apache2/ -> debian, ubuntu ...

1
  • Nginx server we can find under /var/log/nginx Commented Mar 9, 2021 at 10:29
4

Try to run following command in the Magento root and before running this command give the full permissions to the installation directory

php bin/magento setup:static-content:deploy -f
3

Solution: Internal Server Error!! Magento 2.2.2 Very Important !! especially for WAMPserver in windows10

  1. Please make sure that LoadModule version_module modules/mod_version.so is loaded from httpd.conf, This bug cause Internal Server Error of Magento 2.2.2 and if following setting got "#" , pls remove "#"

LoadModule version_module modules/mod_version.so

  1. create a new folder and name it "static" after /pub/ looks like this: http://localhost/magento222/pub/static/ right click the "static" folder and click property to make sure if it is writable.

  2. delete your old mysql database for magento222 and create a new one to make a clean and safe installation.

P.S.: Ver. 2.2.2 is not a stable version.

2

If you are using Magento 2.2.4. Then first go to Apache log directory and

[Wed May 30 00:58:17.857269 2018] [core:alert] [pid 7184:tid 1244] [client 127.0.0.1:65528] C:/Creation/wamp64/www/m2version/ms-live-version/.htaccess: Invalid command '<IfVersion', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 30 00:58:42.568180 2018] [core:alert] [pid 7184:tid 1248] [client 127.0.0.1:49165] C:/Creation/wamp64/www/m2version/ms-live-version/.htaccess: Invalid command '<IfVersion', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 30 00:59:01.667499 2018] [core:alert] [pid 7184:tid 1252] [client 127.0.0.1:49169] C:/Creation/wamp64/www/m2version/ms-live-version/.htaccess: Invalid command '<IfVersion', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 30 01:00:04.655715 2018] [core:alert] [pid 7184:tid 1272] [client 127.0.0.1:49174] C:/Creation/wamp64/www/m2version/ms-live-version/.htaccess: Invalid command '<IfVersion', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 30 01:00:35.151803 2018] [core:alert] [pid 7184:tid 1272] [client 127.0.0.1:49201] C:/Creation/wamp64/www/m2version/ms-live-version/.htaccess: Invalid command '<IfVersion', perhaps misspelled or defined by a module not included in the server configuration

According to the log, the main problem is a .htaccess file. I don't know the exact reason but following code remove from the .htaccess file is working.

Remove file tag code.

<Files composer.json>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files composer.lock>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files .gitignore>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files .htaccess>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files .htaccess.sample>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files .php_cs.dist>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files .travis.yml>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files CHANGELOG.md>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files COPYING.txt>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files Gruntfile.js>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files LICENSE.txt>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files LICENSE_AFL.txt>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files nginx.conf.sample>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files package.json>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files php.ini.sample>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files README.md>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files auth.json>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>
<Files magento_umask>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>

Note : I don't know there may problem in future or not. But it's help me.

2

Fixed the issue by changing file permission of index.php

664 to 644

2

Please check .htaccess first.possibility of module not enabled. Because i faced this issue because of mod_version module so I enabled it from apache and now it's working.

You can check also with replacing your .htaccess file Or renamed it to confirm issue of .htaccess file.

1
  • 2
    i have replace .htaccess file and resolved issue thanks Commented Mar 19, 2018 at 4:35
1
  1. It could also be because of wrong file permissions.
  2. Make sure that you CHMOD to "user":"group" "magento install DIR"
1

I also came across the same situation in morning but thanks to @david answer.

After a bit research of log directory of Apache, I came to know about that apache don't have permission to read app/etc/ folder.

So, after giving permission all working fine.

2
  • 1
    Please tell me the path . Commented Aug 15, 2018 at 9:00
  • If you are on Linux environment then it will be usually /var/log/apache2 or /var/log/httpd/ Commented Sep 16, 2018 at 6:59
1

In my case, it is due to the ownership issues. I was using ubuntu os so I used the following the command to correct ownership.

sudo useradd magento

Now associate this magento user to the web server’s user group. In ubuntu it is by default www-data

sudo usermod -g www-data magento

Now navigate the Magento project directory in the terminal and run following commands.

sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; sudo chown -R magento:www-data . sudo chmod u+x bin/magento

Once these commands run successfully then magento user have all required permission whatever Magento setup needed.

Restart the apache server by the following command

sudo systemctl restart apache2

3
  • your code cost me to loose ownership of my publiv_html folder and everthin inside, anyone that has the issue should run this command to revert chanes: for i in cat /etc/trueuserdomains | awk '{print $2}' > do > chown $i.$i /home/$i -R; > chown $i.mail /home/$i/etc -R; > chown $i.nobody /home/$i/public_html; > chmod 750 /home/$i/public_html; > done; Commented Nov 26, 2019 at 21:07
  • @TheDeadGuy, it was a too old comment. I apologized for it. Now I have edited my answer please try with this. Commented Nov 29, 2019 at 7:46
  • you are forgiven ;) Commented Nov 29, 2019 at 11:56
0

seems need only to index.php

show php errors Show PHP errors

and after can fix

in my case - was permission for dirs

0

Struggled for an hour and finally issue got resolved after removing the proxy settings. Whoever facing this issue, check your proxy setting.

0

Resolved by giving proper file permissions to magento root folder

0
0

It is a very sophisticated issue.

Much possible reason can happen for this. Better than going randomly, debug the issue.

if you are using apache2 to go to /var/log/apache2 and you will found error.log, other there you will found a specific reason why this is happening. And solved it by a search over the internet.

Possible Problem:

  • If you copy files and database from existing site and put directoly on the new server then there may some copatibilty issue, for this upload a freash copy and try to install it, you will found what is missing
  • In the new Magento version, there is a special folder called generated. That must be write permission.
  • Another main reason is overall file permission. Be sure var, generated, vendor, app/etc, pub/media & pub/static have proper write access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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