2

When i try to access these url localhost/magento2/setup

i get

Forbidden

You don't have permission to access /magento2/setup on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80

i added this

<Directory /var/www/html/magento2>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

to the

sudo gedit /etc/apache2/apache2.conf 

this is diirectory

sudo ls /var/www/html/magento2/
app      COPYING.txt          LICENSE_AFL.txt      pub
bin      dev              LICENSE.txt      setup
CHANGELOG.md     Gruntfile.js.sample  nginx.conf.sample    update
composer.json    index.php        package.json.sample  var
composer.lock    ISSUE_TEMPLATE.md    php.ini.sample       vendor
CONTRIBUTING.md  lib              phpserver

i tried a lot of things

this is php

php -v
PHP 7.0.10-2+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.10-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies

this is mysql

root@vegan:/var/www/html/magento2# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 465
Server version: 5.7.13-0ubuntu0.16.04.2 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

this is apache2

root@vegan:/var/www/html/magento2# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-07-14T12:32:26
root@vegan:/var/www/html/magento2# 

there seems no errors with those.

when i go to

http://localhost/magento2/setup

i got error.

i changed to

<Directory /var/www/html/magento2>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

but nothing changed, extra line added to the error.

i also changed permissions described here

https://stackoverflow.com/a/18950561/6690056

and here

Make files and directories writable:

To make files and directories writable so you can update components and upgrade the Magento software:

Log in to your Magento server.
Change to your Magento installation directory.
Enter the following commands:

chmod -R u+w .

but now i get only pag with php code despite localhost shows true page:

for http://localhost/magento2/setup/

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

if (PHP_SAPI == 'cli') {
    echo "You cannot run this from the command line." . PHP_EOL .
        "Run \"php bin/magento\" instead." . PHP_EOL;
    exit(1);
}
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);
}

// For Setup Wizard we are using our customized error handler
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);

\Zend\Mvc\Application::init(require __DIR__ . '/config/application.config.php')->run();

what can be reason?

2

I had the same issue, every time i hit localhost of my mage build it would show the 403 forbidden. I boiled it down to permissions.

What environment are you in? if you are working in a LAMP or MAMP environment, you need to make sure your httpdocs folder is readable.

You'll need to chmod your folder to the correct read write. Open terminal and cd to your folder.

cd /var/www/html/magento2/

chmod 755 httpdocs

I don't think 755 is correct but i know if you're working locally it should be okay. If you need to add it to sub folders please do it -R

Hope this helps.

| improve this answer | |

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.