Hello,
Recently in of our Magento product we installed a Payment Gateway module on our Magento for that we have to run following command.
php bin/magento setup:upgrade php
But every time we run this command we end with following exception.
Missing write permissions to the following directories: public_html/var
so at first it looks like write permission issue in directory, so we gave write permission to directory
chmod 777 ./var
And command run successfully but still we were getting same error while running
php bin/magento setup:upgrade php
That was little wired as we have all the necessary permission but still command was not working. So I decided to get error location and found out following file from where this error is thrown.
setup/src/Magento/Setup/Model/Installer.php
Open this and find following function.
/**
* Check permissions of directories that are expected to be writable for installation
*
* @return void
* @throws \Exception
*/
public function checkInstallationFilePermissions()
{
$results = $this->filePermissions->getMissingWritableDirectoriesForInstallation();
if ($results) {
$errorMsg = "Missing write permissions to the following directories: '" . implode("' '", $results) . "'";
throw new \Exception($errorMsg);
}
}
This is the function which throws an error so what I did is I commented all the code in this function and run the command again
php bin/magento setup:upgrade php
and it worked, it updated properly and after that I again uncommented this code and upload file back to server.
PLEASE NOTE THIS IS A HACK, AS A MAGENTO DEVELOPER I DO NOT SUGGEST TO UPDATE SOURCE FILE BUT THERE WAS NO OTHER OPTION SO I TRIED IT. IF YOU ARE TRYING THIS ON YOUR SIDE, PLEASE BE CAREFUL.
Recently in of our Magento product we installed a Payment Gateway module on our Magento for that we have to run following command.
php bin/magento setup:upgrade php
But every time we run this command we end with following exception.
Missing write permissions to the following directories: public_html/var
so at first it looks like write permission issue in directory, so we gave write permission to directory
chmod 777 ./var
And command run successfully but still we were getting same error while running
php bin/magento setup:upgrade php
That was little wired as we have all the necessary permission but still command was not working. So I decided to get error location and found out following file from where this error is thrown.
setup/src/Magento/Setup/Model/Installer.php
Open this and find following function.
/**
* Check permissions of directories that are expected to be writable for installation
*
* @return void
* @throws \Exception
*/
public function checkInstallationFilePermissions()
{
$results = $this->filePermissions->getMissingWritableDirectoriesForInstallation();
if ($results) {
$errorMsg = "Missing write permissions to the following directories: '" . implode("' '", $results) . "'";
throw new \Exception($errorMsg);
}
}
This is the function which throws an error so what I did is I commented all the code in this function and run the command again
php bin/magento setup:upgrade php
and it worked, it updated properly and after that I again uncommented this code and upload file back to server.
PLEASE NOTE THIS IS A HACK, AS A MAGENTO DEVELOPER I DO NOT SUGGEST TO UPDATE SOURCE FILE BUT THERE WAS NO OTHER OPTION SO I TRIED IT. IF YOU ARE TRYING THIS ON YOUR SIDE, PLEASE BE CAREFUL.
No comments:
Post a Comment