could not open input file bin magento 2
The Main Error We find Every time I type PHP bin/magento setup: upgrade it comes up with Could not open input file: bin/magento
Actually, in magento 2 root directory – we have a folder called bin – so based on that file and reference it running commands.
You need to go to your Magento root path where you have the folder App, PUB,Generated, 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
It seems that the bin/magento file doesn’t have the right permissions.
Try to add execute permissions and check the user owner.
chmod -R 0777 bin or give directory full permissions
(2) Magento file must be missing from folder bin/
Use this code save as magento in the bin folder or copy a fresh copy from magento 2
Basically check the folder where you have run commands
Permissions or add sudo while running commands