juan_ariza131 Posted January 19, 2017 Share Posted January 19, 2017 In the new releases of the versions 1.7.x.x. I found an issue related with the use of __DIR__ and __FILE__ constants to build paths and persistence environments.I will try to describe the situation: Prestashop Installation Directory: /home/user/prestashop/ Persistence Directory: /persitance/prestashop/ Directories to Persist: /home/user/prestashop/modules, /home/user/prestashop/config, /home/user/prestashop/uploads, /home/user/prestashop/downloads, /home/user/prestashop/themes, /home/user/prestashop/img, /home/user/prestashop/app/config and /home/user/prestashop/app/logs. I created symlinks from /home/user/prestashop/DIRECTORY to /persitance/prestashop/DIRECTORY for every directory I wanted to persist. The purpose of this is being able to persist the DATA of PrestaShop on a Volume with benefits on containers environments. Problem: On previous versions (1.6.x.x) I just needed to edit the file `config/defines.inc.php`: /* Directories */ if (!defined('_PS_ROOT_DIR_')) { define('_PS_ROOT_DIR_', realpath($currentDir.'/..')); } with: /* Directories */ if (!defined('_PS_ROOT_DIR_')) { define('_PS_ROOT_DIR_', '/home/user/prestashop'); } All the paths were built using that constant and everything worked fine.So... What's the problem now? There are dozens of php files under some of the persisted directories that use __DIR__ and __FILE__ php constants to build relative paths. When using those constants (e.g. file: modules/welcome/welcome-api.php line 27): require_once(__DIR__.'/../../init.php'); The path is resolved to /persisted/prestashop/init.php since __DIR__ is resolved using the path to the persisted directory. However, the file referenced is NOT persisted and it's actually is at /home/user/prestashop/init.php. The situation described before creates dozens of Server Internal Errors. Is there anyway to configure the PrestaShop 1.7.x.x to indicate to ALL the files to build the paths using '_PS_ROOT_DIR_' as we could did it before? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted January 23, 2017 Share Posted January 23, 2017 We have installed setup stores with PrestaShop 1.7 and never face such issue till now. It seems that there is some problem with the configuration and we can only suggest you to try re-installing your PrestaShop 1.7 store. Link to comment Share on other sites More sharing options...
juan_ariza131 Posted January 23, 2017 Author Share Posted January 23, 2017 Knownband Plugins the issue I'm reporting here is not related with the installation of Prestashop. It's related with "persistence on containers". I am able to install PrestaShop but then I want to be able to persist some data on a volume attached to the container. The changes I detailed before describe the process I followed. As I mentioned before the new version's approach to create the paths inside PrestaShop has changed and it's less tolerant to changes in the directory structure. I'm having issues because of incompatibilities on a symlink environment.Could someone try to reproduce the scenario I am describing and suggest a workaround? Thanks in advance. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now