cancel
Showing results for 
Search instead for 
Did you mean: 

Could not open input file: bin/magento

SOLVED

Could not open input file: bin/magento

Hi,

I installed magento today, however, I can't seem to upgrade the theme.

 

Every time I type php bin/magento setup:upgrade it comes up with Could not open input file: bin/magento

 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Could not open input file: bin/magento

Hi @modestas_mankus

 

Yes - its showing this error Could not open input file: bin/magento because you are not running this command in magento 2 root directory.

 

Actually in magento 2 root directory - we have folder called bin - so based on  that file and reference it running commands.

 

So here i would suggest you to go into the magento 2 root directory by using CD command

 

then run the given commands it will works !

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

View solution in original post

4 REPLIES 4

Re: Could not open input file: bin/magento

You need to go to your Magento Instance path, where your composer.json file resides, via Command Line.

If your instance magento folder then you need to go at /var/www/html/magento path via Command line,

Now Run the Command,

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento setup:di:compile
php bin/magento cache:flush
php bin/magento indexer:reindex
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Could not open input file: bin/magento

Hi @modestas_mankus

 

Yes - its showing this error Could not open input file: bin/magento because you are not running this command in magento 2 root directory.

 

Actually in magento 2 root directory - we have folder called bin - so based on  that file and reference it running commands.

 

So here i would suggest you to go into the magento 2 root directory by using CD command

 

then run the given commands it will works !

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

View solution in original post

Re: Could not open input file: bin/magento

It seems that bin/magento file doesn't have the right permissions.

Try to add execute perm and check the user owner.

chmod u+x bin/magento

(2) Magento file must  missing from folder bin/

Use this code save as magento in bin folder or copy fresh copy from magento 2 

#!/usr/bin/env php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

if (PHP_SAPI !== 'cli') {
    echo 'bin/magento must be run as a CLI application';
    exit(1);
}

try {
    require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
    echo 'Autoload error: ' . $e->getMessage();
    exit(1);
}
try {
    $handler = new \Magento\Framework\App\ErrorHandler();
    set_error_handler([$handler, 'handler']);
    $application = new Magento\Framework\Console\Cli('Magento CLI');
    $application->run();
} catch (\Exception $e) {
    while ($e) {
        echo $e->getMessage();
        echo $e->getTraceAsString();
        echo "\n\n";
        $e = $e->getPrevious();
    }
    exit(Magento\Framework\Console\Cli::RETURN_FAILURE);
}

Re: Could not open input file: bin/magento

Please check your Magento root dir bin/ here magento.php file is available is its is not please copy from another Magento project this file and placed here the check-in your console or terminal 

 

PHP bin/magento 

 

Appear lists of commands its means now working fine.