I have searched the forum many times now, but did not come across a question that seems pretty common to me:
In any normal shared hosting situation, you typically have a user which is the owner of your www home directory, and apache runs as www-data.
It is common practice to have the directory permissions set to 755 or even 750 will work just fine.
Now, the following folders should be allowed by OCmod to be written to:
'admin/controller/extension/',
'admin/language/',
'admin/model/extension/',
'admin/view/image/',
'admin/view/javascript/',
'admin/view/stylesheet/',
'admin/view/template/extension/',
'catalog/controller/extension/',
'catalog/language/',
'catalog/model/extension/',
'catalog/view/javascript/',
'catalog/view/theme/',
'system/config/',
'system/library/',
'image/catalog/'
but it will fail as most of these are only writable by the owner (user), not Apache (www-data group). Changing all of these to 775 is a security threat as all users on the shared host could then write to and modify these folders and also not part of OpenCart's recommended installation.
So how on earth is OCmod supposed to write there ? What obvious piece am I missing ?
Thanks
See this extension
https://www.opencart.com/index.php?rout ... n_id=33410
So you mean that restriction doesn't work on shared hosting?omikron777 wrote: ↑Tue Jan 19, 2021 6:14 pmNo, I am not talking about "The directory xxx is not allowed to be written to!" which is an OC restriction of the installer.
Ocmod doesn't write there. It creates a modified file in your storage/modification directory.omikron777 wrote: ↑Tue Jan 19, 2021 5:58 pmSo how on earth is OCmod supposed to write there ? What obvious piece am I missing ?
For proper permissions you should contact your web host as it can depend on the PHP handler being used.
Typically its
644 for files
755 for folders
But can vary depending on your server setup, best to confirm with your host.
Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
So if you have the *.ocmod.zip file, there is the install.xml inside which will write to the oc_storage folder, but also the "upload" folder with custom files from the extension which are uploaded to the main OC file structure, not inside the storage folder.
myextension.ocmod.zip
=> install.xml
=> upload /
======== > admin / controller / extension / extension / myextension.php
======== > admin / language / en-gb / extension / extension / myextension.php
for example. These files will be written by the extension installer into these folders, list of "OC allowed folders" as in my original post.
The point is that PHP / Apache does not have write access to these, because you normally have only the image and oc_storage folders writable by the server.
So the installation does not work as the rename() in install.php fails due missing unix permissions. I don't want to set all these folders to 775 or 770 as any scripts on the shared server can then write there.
I hope I explained myself better now.
Domain permission issues. If these permissions were set recursively on the folders starting from the oc_storage folder to the child folders altogether from the FTP and you're still experiencing issues with CHMOD 0755, then you need to contact your host to resolve this issue.The point is that PHP / Apache does not have write access to these, because you normally have only the image and oc_storage folders writable by the server.
So the installation does not work as the rename() in install.php fails due missing unix permissions. I don't want to set all these folders to 775 or 770 as any scripts on the shared server can then write there.
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
My question is: Can I install extensions (*.ocmod.zip) with something inside the /upload/ folder in the extension without setting all these directories to 775 ?
Apache cannot write to for example /admin/controller/extension etc. as it is not the owner of these folders. I know I can resolve this by making them 775, but I don't want to ! Is that possible ?
That answer was already provided on the above. If you don't want to, then it's not an OC issue at this point but definitely unrelated where this forum does not support.omikron777 wrote: ↑Wed Jan 20, 2021 1:44 amShall we forget the oc_storage folder as the extension is trying to upload files to the main OC file structure ?
My question is: Can I install extensions (*.ocmod.zip) with something inside the /upload/ folder in the extension without setting all these directories to 775 ?
Apache cannot write to for example /admin/controller/extension etc. as it is not the owner of these folders. I know I can resolve this by making them 775, but I don't want to ! Is that possible ?
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
It is definitely OC related, because the OCMod "Zip file extension installation" system was invented by OC and needs write permissions to it's folder structure.
If that is a requirement of OC, that is fine, I thought at least somebody would acknowledge that.
50% Off SSD Shared Hosting w/ cPanel
Detailed guide on how to install Opencart
system/storage/cache/
system/storage/download/
system/storage/logs/
system/storage/modification/
system/storage/session/
system/storage/upload/
system/storage/vendor/
image/
image/cache/
image/catalog/
However, in order for extensions to upload correctly (myextension.ocmod.zip) WITH files in the /upload/ folder inside, the whole Opencart folder structure must be writeable by Apache, not only the above folders. I know how to do that, that is not my point. I was surprised to find out this requirement and was wondering if it was me that did not understand something or Opencart's instructions do not allow the extension installer to work correctly.
Code: Select all
if (is_dir($file) && !is_dir($path)) {
if (mkdir($path, 0777)) {
$this->model_setting_extension->addExtensionPath($extension_install_id, $destination);
}
}
if (is_file($file)) {
if (rename($file, $path)) {
$this->model_setting_extension->addExtensionPath($extension_install_id, $destination);
}
}
'admin/controller/extension/',
'admin/language/',
'admin/model/extension/',
'admin/view/image/',
'admin/view/javascript/',
'admin/view/stylesheet/',
'admin/view/template/extension/',
'catalog/controller/extension/',
'catalog/language/',
'catalog/model/extension/',
'catalog/view/javascript/',
'catalog/view/theme/',
'system/config/',
'system/library/',
'image/catalog/'
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos
when the server is set up correctly and OC installed, www-data WILL have write access to those folders for installing extensions. So if you have locked down your server with restrictions then that's up to you. Its not a problem of opencart.
On shared hosting its better to have seperate user accounts per virtual host, that what big clustered hosting companies do, the user has the same as www-data but ONLY for that particular virtualhost.
So do any extensions or OCMOD require files to be installed in any of those locationsby mona wrote: ↑Fri Jan 22, 2021 8:04 amIt was an intentional introduction not to allow OCMOD to write to all files and folders
'admin/controller/extension/',
'admin/language/',
'admin/model/extension/',
'admin/view/image/',
'admin/view/javascript/',
'admin/view/stylesheet/',
'admin/view/template/extension/',
'catalog/controller/extension/',
'catalog/language/',
'catalog/model/extension/',
'catalog/view/javascript/',
'catalog/view/theme/',
'system/config/',
'system/library/',
'image/catalog/'
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos
but thank you for yet again feeling the need to pull me down for you own satisfaction, maybe a post count, who knows, who cares.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos
Just more to point out what's writable, what's not, what OC controls and what the apache user has access to, as the OP is clearly confused by some OC documentation.
Users browsing this forum: ventienda and 6 guests