0

sorry for creating another 500 Internal server error thread but I couldn't find any solution for my problem yet.

We have a managed server from German provider 1&1 and we have a running magento website on it with 1.9.4.1 which works fine.

I installed a fresh Magento 2.3.1 on this server and installation completes without any problems, all requirements like php7.2, Apache 2.4, requested extensions and file permissions are fine.

After the installation the backend gives 500 Internal Server error and frontend is without any design. I figured out that for the frontend the rewrites for pub/static are not working and found a changed .htaccess for pub/static to get the design loading on the frontend. But still any links in the frontend and the whole backend end with 500...

I tried solutions found on the web like deleting .htaccess, file permissions and disabling static rewrites in mySQL but they didn't help. I can not reach developer mode in ssh so I enabled developer mode with env.php, debug shows errors like:

[2019-05-21 09:42:27] main.DEBUG: cache_invalidate: {"method":"GET","url":"http://test.tudi-billo.de/","invalidateInfo":{"identifier":"interception"}} []

[2019-05-21 09:42:36] main.DEBUG: cache_invalidate: {"method":"GET","url":"http://test.tudi-billo.de/","invalidateInfo":{"identifier":"SYSTEM_CONFIG"}} []

[2019-05-21 09:42:37] main.INFO: Broken reference: the 'catalog.compare.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []

[2019-05-21 09:42:37] main.INFO: Broken reference: the 'sale.reorder.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []

Now I'm stuck and the server provider won't help anymore as they say Magento is the problem, not their server. I guess there is an overall problem with rewrites and therefore the backend can not be found.

Any idea how to find the error or how to solve this?

  • Have you disabled https on front end and backend as well? check permission as well – Saphal Jha May 21 at 9:54
  • Have you checked your error logs on the server? This sounds like an apache_mod issue. – andy jones May 21 at 9:54
  • Have you checked if Apache Rewrites is enabled in your browser? – Raj Mohan R May 21 at 9:57
  • https is disabled for both, front and backend, permissions I tried as I found here in the forum and also with 777 for all, no difference. – TB Dennis May 21 at 10:18
  • I guess it is a rewrite problem, how to check Apache rewrites in browser? – TB Dennis May 21 at 10:19
0

Go to bootstrap.php it will be inside app (use this to edit sudo nano app/bootstrap.php) and then uncomment this line ini_set('display_errors', 1); so that you can debug your error

  • let me know if any issues – mohith May 21 at 9:59
  • I made this change but where do I see the errors? debug.log still shows the same and when opening backend no error shows except of 500 Internal Server Error – TB Dennis May 21 at 10:19
  • 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: – mohith May 21 at 10:23
  • /var/log/httpd/ -> centos, archlinux ... /var/log/apache2/ -> debian, ubuntu .. – mohith May 21 at 10:24
0

I had a similar problem on one install - turned out to be mod_version apache module is not enabled. This needs enabling. Or you need to edit .htacesss and take out those parts. Without it the site will 500. In this case this is a hosting issue.

Magento 2: Apache mod version not enabled/installed/allowed by host, causes 500 error on all pages due to failing .htaccess files

I also recommend using a check script to make sure you have everything you need. You should as Magento installed. But worth a check.

Here is one such script

https://github.com/sjanjic/magento2-check/blob/master/index.php

check.php

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

function result($value, $result)
{
    if ($result) {
        return array('css' => 'success', 'note' => $value . ': OK');
    }
    return array('css' => 'danger', 'note' => $value . ': FAIL');
}

function apacheModules()
{
    $results = array();
    preg_match('/([\d]+\.[\d]+\.[\d]+)/', apache_get_version(), $version);
    $results[0] = array('css' => 'danger', 'note' => 'Version: ' . $version[0]);
    if (version_compare($version[0], '2.2') >= 0) {
        $results[0] = array('css' => 'success', 'note' => 'Version: ' . $version[0]);
    }
    $requiredModules = array('mod_rewrite','mod_expires');
    $apacheModules = apache_get_modules();
    foreach ($requiredModules as $req) {
        $results[] = result($req, in_array($req, $apacheModules));
    }
    return $results;
}

function phpExtensions()
{
    $results = array();
    preg_match('/([\d]+\.[\d]+\.[\d]+)/', phpversion(), $version);
    $ver = $version[0];
    $results[0] = array('css' => 'danger', 'note' => 'Version: ' . $ver);
    if ((version_compare($ver, '5.6.5', '>=') && version_compare($ver, '7.0.0', '<')) || version_compare($ver, '7.0.2',
            '==') || version_compare($ver, '7.0.4', '==') || version_compare($ver, '7.0.6', '>=')
    ) {
        $results[0] = array('css' => 'success', 'note' => 'Version: ' . $ver);
    }
    $requiredExtensions = array(
        'curl',
        'gd',
        'intl',
        'mbstring',
        'mcrypt',
        'openssl',
        'PDO',
        'SimpleXML',
        'soap',
        'xml',
        'xsl',
        'zip',
        'json',
        'iconv',
        'Zend OPcache',
        'xdebug',
    );
    $phpExtensions = get_loaded_extensions();
    foreach ($requiredExtensions as $req) {
        $results[] = result($req, in_array($req, $phpExtensions));
    }
    return $results;
}

function phpOptionalExtensions()
{
    $optionalExtensions = array(
        'imagick',
    );
    $phpExtensions = get_loaded_extensions();
    $results = array();
    foreach ($optionalExtensions as $opt) {
        $results[] = result($opt, in_array($opt, $phpExtensions));
    }
    return $results;
}
//apacheModules();
?>
<!DOCTYPE html>
<html>
<head>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
          integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
    <h1>Magento 2 requirements check script</h1>
    <div class="panel panel-default">
        <div class="panel-heading">Apache</div>
        <div class="panel-body">
            <?php foreach (apacheModules() as $result): ?>
                <div class="alert alert-<?php echo $result['css'] ?>" role="alert"><?php echo $result['note'] ?></div>
            <?php endforeach; ?>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">PHP</div>
        <div class="panel-body">
            <div role="alert" class="alert alert-warning">Loaded php.ini file: <?php echo php_ini_loaded_file()?></div>
            <?php foreach (phpExtensions() as $result): ?>
                <div class="alert alert-<?php echo $result['css'] ?>" role="alert"><?php echo $result['note'] ?></div>
            <?php endforeach; ?>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">Optional PHP Extension</div>
        <div class="panel-body">
            <?php foreach (phpOptionalExtensions() as $result): ?>
                <div class="alert alert-<?php echo $result['css'] ?>" role="alert"><?php echo $result['note'] ?></div>
            <?php endforeach; ?>
        </div>
    </div>
</div>
</body>
</html>

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.