cancel
Showing results for 
Search instead for 
Did you mean: 

Installing Magento2.3,visit the homepage shows Index of ...

Installing Magento2.3,visit the homepage shows Index of ...

Image.png

magento is the magento2.3  installation folder

vist the localhost/magento error or click magento show code

<?php
/**
 * Application entry point
 *
 * Example - run a particular store or website:
 * --------------------------------------------
 * require __DIR__ . '/app/bootstrap.php';
 * $params = $_SERVER;
 * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
 * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
 * $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
 * \/** @var \Magento\Framework\App\Http $app *\/
 * $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
 * $bootstrap->run($app);
 * --------------------------------------------
 *
 * Copyright 漏 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

try {
    require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Autoload error</h3>
    </div>
    <p>{$e->getMessage()}</p>
</div>
HTML;
    exit(1);
}

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);

 

 

6 REPLIES 6

Re: Installing Magento2.3,visit the homepage shows Index of ...

Image.png

magento is the magento2.3  installation folder

vist the localhost/magento error

<?php
/**
 * Application entry point
 *
 * Example - run a particular store or website:
 * --------------------------------------------
 * require __DIR__ . '/app/bootstrap.php';
 * $params = $_SERVER;
 * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
 * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
 * $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
 * \/** @var \Magento\Framework\App\Http $app *\/
 * $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
 * $bootstrap->run($app);
 * --------------------------------------------
 *
 * Copyright 漏 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

try {
    require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Autoload error</h3>
    </div>
    <p>{$e->getMessage()}</p>
</div>
HTML;
    exit(1);
}

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);

 

Re: Installing Magento2.3,visit the homepage shows Index of ...

Hello @yongchao_ma 

 

Well you will require to point your magento folder to the localhost !

 

Meaning currently its showing magento as an directory - that means your magento installed setup is not the root directory !

 

So let's say if you have installed your Magento 2.3  in magento directory then your browser path should be like this - http://localhost/magento 

 

this will load index.php file from the Magento root directory and you will not able to see index of on the browser.

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: Installing Magento2.3,visit the homepage shows Index of ...

Thank you @Manthan Dave 

My root directory is  /var/www/html 

I have installed my Magento 2.3  in   /var/www/html/magento 

And i also have  set mymagento  website base-url   http://localhost/magento when i install magento.

Click  http://localhost/magento it show the php code,so i think apache can not load php。

 

Re: Installing Magento2.3,visit the homepage shows Index of ...

Hi @yongchao_ma 

 

Yes if its showing index.php - PHP code as an plain text that means your Apache and PHP are not interconnected !

 

You will require to configure your PHP with your Apache ! Something like below code :

 

AddType application/x-httpd-php .php

Then it will not showcase as plain text 

 

you can refer this link for the same - https://stackoverflow.com/questions/3555681/why-are-my-php-files-showing-as-plain-text

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: Installing Magento2.3,visit the homepage shows Index of ...

If you are running the magento in Windows, make sure you have the WAMP/XAMPP server installed and have started the apache services.

 

If you are running the magento in Linnux, make sure you have PHP installed and have started the apache services.

 

If issue solved,Click Kudos & Accept as Solution

Re: Installing Magento2.3,visit the homepage shows Index of ...

You should install the PHP  library for Apache.

apt-get install libapache2-mod