Usually, you get the error bash permission denied when running some script/file that does not have execute permissions. It is one of the most common Magento errors. All you need to do to fix it is to change file permissions and add executive one.
To fix the bash permission denied error follow these steps:
1. Open terminal (shell)
2. Navigate to the folder with the script
3. Run the CLI command to change file permission settings:
chmod +x path_to_file/file_name
For example, if you run a Magento 2 CLI command:
and get the error:
bash: bin/magento: Permission denied
You need to add an execute (x) permission to the bin/magento file.
For this, please run the CLI command:
chmod +x bin/magento
In case of Magento 2 you can also use the next command to avoid the issue (php before bin/magento):
php bin/magento ...
Another issue you might face when running bin/magento commands, like the following ones, is the website breakdown during deployment:
bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy
The deployment might take enough time to drive people off your website and increase bounce rates.
But it doesn't have to be like that.
Check out Magento 2 Zero Downtime Deployment extension that will decrease the deployment time to zero with no broken website, not bouce rates, and no inconvenient time deployment.