Post by JackD » Wed Dec 27, 2017 7:41 am

Hi All,
I am hosting OpenCart websites, mostly 2.x ones.
As I am getting familiar with version 3.x, I just want to know more about this storage folder moving outside the web directory, what pops up as an important security notfication at first OC setups.
As a sysadmin, I just simply don't get this security solution. I've never met something like this before using other engines.
Why is this important? And what are the exact permission requirements for the moved folder?
Can anyone explain these for me from a sysadmin point of view? I couldn't find any specific details in documentation.
???

Newbie

Posts

Joined
Wed Dec 27, 2017 7:32 am

Post by straightlight » Thu Dec 28, 2017 1:12 am

Requires domain permissions for Opencart to write its cache data when either using vendors, cache and extensions. Move your system/storage outside your public_html folder. Then, set recursive settings to the storage folder with CHMOD 0755. In your config.php and admin/config.php files, edit your DIR_STORAGE definition folder to its new destination as well as from your .htaccess file (if found in your .htaccess file as well).

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by JackD » Thu Jan 04, 2018 7:43 am

If I have multiple Opencart 3.x sites hosted on my linux server, virtualhosts stored in /var/www/, should I move storage directories of all sites to different directories outside /var/www/{site}/, named diferently after the sites?
e.g.:
/var/www/site1/system/storage -> /var/www/site1_storage
/var/www/site2/system/storage -> /var/www/site2_storage
/var/www/site3/system/storage -> /var/www/site3_storage
straightlight wrote:
Thu Dec 28, 2017 1:12 am
Requires domain permissions for Opencart to write its cache data when either using vendors, cache and extensions. Move your system/storage outside your public_html folder. Then, set recursive settings to the storage folder with CHMOD 0755. In your config.php and admin/config.php files, edit your DIR_STORAGE definition folder to its new destination as well as from your .htaccess file (if found in your .htaccess file as well).

Newbie

Posts

Joined
Wed Dec 27, 2017 7:32 am

Post by straightlight » Thu Jan 04, 2018 7:55 am

Good question. :)

Each domain should use their own storage folder so to avoid cache conflict. Although, each config.php and admin/config.php files of each stores must also be configured accordingly as well as each .htaccess files from the OC root store path by remove the entire line where the system/storage is located.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by hobiesan » Sun Mar 11, 2018 10:23 am

I am installing Opencart for the first time, and am getting the pop-up window in the admin area telling me to move the storage directory. However, my pop-up window is incomplete. I've seen others post images of their pop-up window and there is a bottom section with a place to enter a path and a "Move" button. My pop-up window does not have this bottom section. And there is no scroll bar on the window to move it down. I would post an image, but I cannot seem to upload an image to this forum either. FWIW, I'm not a noob on computers, as I have been a engineer/developer for over 25 years.

I am running Chromium 64.0 browser on a Debian 9.3 linux system, and my opencart is hosted on Dreamhost. Adblock is turned off for my Opencart site.

I guess I can try moving the storage directory manually via an ssh login, and editing the appropriate config.php files. But I thought I'd mention this problem in case anyone else has also had this problem, and in case a Issue needed to be opened on Github.

Also, I downloaded the Opencart from Github, so I probably installed the latest code from the master branch. Maybe this is the issue?

Newbie

Posts

Joined
Sun Mar 11, 2018 9:50 am

Post by Johnathan » Thu Mar 15, 2018 12:44 am

NEVER install OpenCart from github. While it does contain bugfixes, it also usually has unfinished code, and you're likely going to run into issues if you use that. Always use the official versions found here:

https://www.opencart.com/index.php?route=cms/download

The latest version 3.0.2.0 does have bugs, which you can look for fixes in the bugfix forum topic or on github, and then fix yourself. Hopefully one of these days we'll actually get an official 3.0.3.0 release that has the bugfixes in it...

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by straightlight » Thu Mar 15, 2018 1:21 am

FWIW, I'm not a noob on computers, as I have been a engineer/developer for over 25 years.
Despite the un-relative years of experience since Opencart hasn't been created at that time, while the above is correct regarding the stable releases to be used rather than the dev versions, followed are instructions on how to resolve these issues with the security modal window when the automatic settings has not been selected but rather the manual option on PCI servers: viewtopic.php?f=202&t=201745#p713479

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by aoe123 » Thu Oct 17, 2019 5:05 am

hi there,

everything is fine with installation except this fucking move thing.

i already installed many scripts but this one is really annoying. why i have to move something?

it wastes my time and its annoying because it doesnt work. not automatically and also not manually.
where i have to change what? please give me exact advises, thanks!

when i wanna move it automatically i get this looong message:

Image

the hoster is hoststar.
so what can i do??
please clear and straight answers, thanks.

New member

Posts

Joined
Tue Oct 15, 2019 3:30 pm

User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Lytrax » Thu Feb 13, 2020 9:07 am

We could avoid all that move thing outside of the webroot if we add a simple Apache htaccess to `/storage/` directory:

Code: Select all

## no access to this folder

# Apache 2.4
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>

# Apache 2.2
<IfModule !mod_authz_core.c>
    Order Allow,Deny
    Deny from all
</IfModule>
Or to the webroot htaccess:

Code: Select all

RewriteRule ^(/storage/) - [F,L,NC]
There are also simple config options for Nginx servers.

Newbie

Posts

Joined
Thu Feb 13, 2020 9:00 am

Post by straightlight » Thu Feb 13, 2020 8:27 pm

Lytrax wrote:
Thu Feb 13, 2020 9:07 am
We could avoid all that move thing outside of the webroot if we add a simple Apache htaccess to `/storage/` directory:

Code: Select all

## no access to this folder

# Apache 2.4
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>

# Apache 2.2
<IfModule !mod_authz_core.c>
    Order Allow,Deny
    Deny from all
</IfModule>
Or to the webroot htaccess:

Code: Select all

RewriteRule ^(/storage/) - [F,L,NC]
There are also simple config options for Nginx servers.
Take note that the above changes are server-specifics and may not respond on other servers. In addition, those changes does not specifically reflect on the storage folder as opposed to the original instructions in the FAQ.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Cue4cheap » Mon May 25, 2020 5:40 am

Can I just create the storage directory outside the web directory and the rest will be created? i.e. cache, download, modification, session, etc.?

Thanks!

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by straightlight » Mon May 25, 2020 5:57 am

By following the FAQ instructions (first post), you still need to move all sub-folders along with the storage folder outside of your public_html folder as described here: viewtopic.php?f=134&t=215776#p717782

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by rubensyanesb » Wed May 27, 2020 11:29 pm

Hi!
I am installing Open Cart v3.0.3.3 in order to migrate a site from an older version.
Everything was fine until I moved the storage folder outside the public_html folder.

After the move, I edited the config files of the main folder and the admin folder in this way, following the documentation:
Main folder Config.php

Code: Select all

define('DIR_APPLICATION', '/home/c1300630/public_html/2020/catalog/');
define('DIR_SYSTEM', '/home/c1300630/public_html/2020/system/');
define('DIR_IMAGE', '/home/c1300630/public_html/2020/image/');
define('DIR_STORAGE' . '/storage/');
Admin Config.Php

Code: Select all

define('DIR_SYSTEM', '/home/c1300630/public_html/system/');
define('DIR_IMAGE', '/home/c1300630/public_html/image/');
define('DIR_LANGUAGE', '/home/c1300630/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/c1300630/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/c1300630/public_html/system/config/');
define('DIR_STORAGE', '/storage/'); 
But it seems that the systme doesn´t take the change in account.
I am having these warnings in the front end:

Code: Select all

Warning: fopen(DIR_STORAGElogs/openbay.log): failed to open stream: No such file or directory in /home/c1300630/public_html/2020/system/library/log.php on line 22Warning: Cannot modify header information - headers already sent by (output started at /home/c1300630/public_html/2020/system/framework.php:42) in /home/c1300630/public_html/2020/catalog/controller/startup/session.php on line 25Warning: Cannot modify header information - headers already sent by (output started at /home/c1300630/public_html/2020/system/framework.php:42) in /home/c1300630/public_html/2020/catalog/controller/startup/startup.php on line 99Warning: Cannot modify header information - headers already sent by (output started at /home/c1300630/public_html/2020/system/framework.php:42) in /home/c1300630/public_html/2020/catalog/controller/startup/startup.php on line 157Warning: fopen(DIR_STORAGElogs/openbay.log): failed to open stream: No such file or directory in /home/c1300630/public_html/2020/system/library/log.php on line 22Warning: fclose() expects parameter 1 to be resource, boolean given in /home/c1300630/public_html/2020/system/library/log.php on line 39Warning: fopen(DIR_STORAGElogs/error.log): failed to open stream: No such file or directory in /home/c1300630/public_html/2020/system/library/log.php on line 22
And in admin I am able to login, but immediately I got an error screen with the following message and nothing else:

Code: Select all

Warning: fopen(/storage/logs/openbay.log): failed to open stream: No such file or directory in /home/c1300630/public_html/2020/system/library/log.php on line 22Warning: fopen(/storage/logs/error.log): failed to open stream: No such file or directory in /home/c1300630/public_html/2020/system/library/log.php on line 22Warning: Cannot modify header information - headers already sent by (output started at /home/c1300630/public_html/2020/system/framework.php:42) in /home/c1300630/public_html/2020/system/library/response.php on line 36Warning: fclose() expects parameter 1 to be resource, boolean given in /home/c1300630/public_html/2020/system/library/log.php on line 39Warning: fclose() expects parameter 1 to be resource, boolean given in /home/c1300630/public_html/2020/system/library/log.php on line 39Warning: fclose() expects parameter 1 to be resource, boolean given in /home/c1300630/public_html/2020/system/library/log.php on line 39
Last edited by straightlight on Thu May 28, 2020 8:11 pm, edited 1 time in total.
Reason: Please use the code tags!

Newbie

Posts

Joined
Tue May 12, 2020 7:00 am

Post by straightlight » Thu May 28, 2020 8:12 pm

Replace both instances of:

Code: Select all

define('DIR_STORAGE', '/storage/');
with:

Code: Select all

define('DIR_STORAGE', '/home/c1300630/storage/');
Then, ensure to follow this FAQ afterwards: viewtopic.php?f=134&t=215776#p718325 . This should resolved the issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by aoe123 » Tue Apr 27, 2021 5:25 pm

Bingo the first link was and is still the solution. The rest in this post is just blablabla.. thanks and solved!

New member

Posts

Joined
Tue Oct 15, 2019 3:30 pm

Post by straightlight » Tue Apr 27, 2021 7:25 pm

aoe123 wrote:
Tue Apr 27, 2021 5:25 pm
Bingo the first link was and is still the solution. The rest in this post is just blablabla.. thanks and solved!
As per the FAQ, this modal security window is also server-specifics as, from other servers, using this feature may cause further problems, by using the automated setting, and rather requires the storage folder to be moved manually. However, if the automated setting worked for you, you're just one of the lucky ones. Thanks for posting the feedback.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by rgfuelcells » Wed Aug 11, 2021 5:17 am

Followup question for those who have installed OpenCart 3 locally first and then uploaded that same website to the server. I installed OpenCart locally and I responded to the "Move the Storage" prompt by manually moving the folder. Typically people using XAMPP install their websites into the htdocs folder so for example my website is installed in this directory (my-website isn't really its name):
C:/xampp/htdocs/my-website/

And then when I moved the storage folder from my-website the storage folder's directory became this:
C:/xampp/storage/

Now I want to upload my-website into my server. With most PHP hosts they upload their websites into a folder called public_html. So for example my website's directory became this after uploading (my-server-name isn't really its name):
/home/my-server-name/public_html/my-website/

However when I uploaded my-website with FTP the storage folder wasn't uploaded along with the rest of the website. So should I upload it manually with cPanel? And if so would it be into this directory:
/home/my-server-name/storage/

Newbie

Posts

Joined
Thu Jun 24, 2021 2:49 am

Post by straightlight » Wed Aug 11, 2021 5:32 am

rgfuelcells wrote:
Wed Aug 11, 2021 5:17 am
Followup question for those who have installed OpenCart 3 locally first and then uploaded that same website to the server. I installed OpenCart locally and I responded to the "Move the Storage" prompt by manually moving the folder. Typically people using XAMPP install their websites into the htdocs folder so for example my website is installed in this directory (my-website isn't really its name):
C:/xampp/htdocs/my-website/

And then when I moved the storage folder from my-website the storage folder's directory became this:
C:/xampp/storage/

Now I want to upload my-website into my server. With most PHP hosts they upload their websites into a folder called public_html. So for example my website's directory became this after uploading (my-server-name isn't really its name):
/home/my-server-name/public_html/my-website/

However when I uploaded my-website with FTP the storage folder wasn't uploaded along with the rest of the website. So should I upload it manually with cPanel? And if so would it be into this directory:
/home/my-server-name/storage/
Unless using a dedicated and fully managed server, the modal window should not be responded but rather ignored and to move the storage folder manually from your cPanel's file manager to speed up the process as per the FAQ. Then, to download the store to your local virtual server such as XAMPP. The storage folder can simply be re-recreated locally and ensure both config.php files do match the new storage path and their sub-folders accordingly as well as your database paths and URLs in your tables. As to re-upload your store to the server, that would be correct as long as both config.php files and database paths and URLs in your tables are also renamed back accordingly. Also take note that your storage folder must be set to CHMOD 0755 recursively on your folders - not on files - from FTP. No errors must present themselves during the CHMOD operation.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by validsyntax » Sun Jan 22, 2023 10:25 pm

Basically the easy way to do this is to chmod that directory that you want to move the storage folder to first say you set this /home/ First go to shell and

chmod -R 777 /home/

don't create a folder or anything

Next just simply use the open cart GUI to move the folder for you now that it has the permissions

Almost im not saying 777 is best security practice maybe a 755 or come up with your own command that will work i just did this for experimental purpose when i was setting this up it worked flawless

Newbie

Posts

Joined
Sun Jan 22, 2023 8:10 am
Who is online

Users browsing this forum: No registered users and 141 guests