OpenCart is a popular and powerful option for building an online store, and you can run it on InfinityFree! However, there are a few special steps you need to follow to ensure OpenCart runs smoothly on our hosting platform.
The good news is that you can install OpenCart using Softaculous with just a few minor changes.
Configuring the Data Directory
OpenCart requires a Data Directory to function properly. This directory stores part of OpenCart’s code, as well as uploaded files, caches, and other necessary files.
By default, Softaculous sets the OpenCart data directory to ocartdata:
However, this default setting will not work on our hosting platform because PHP code cannot access files outside the htdocs directory of the website it runs on.
To resolve this issue, follow these steps:
-
Check your domain directory:
- In the client area, navigate to Accounts → Your Account → Domains.
- Identify the directory linked to your domain in the Directory column.
-
Modify the Data Directory in Softaculous:
- Prefix the Data Directory with your website directory, adding a slash between them. For example, if the directory is
htdocs, the Data Directory should behtdocs/ocartdata:
- Prefix the Data Directory with your website directory, adding a slash between them. For example, if the directory is
Fixing the open_basedir error
As of OpenCart version 4.0.2.3, there is a known bug related to the open_basedir configuration on our hosting platform. When you try to open your OpenCart site, you may see an error like this:
Warning: is_dir(): open_basedir restriction in effect.
File(/) is not within the allowed path(s):
(/php_sessions:/tmp:..:/var/www/errors:/home/...)
in /home/.../ocartdata/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 91
The "/" directory does not exist ("/").
This issue has been identified and fixed in the OpenCart repository, but the fix has not yet been released. Fortunately, you can easily apply the fix manually.
To do this:
- Access the File Manager.
- Locate the file at
htdocs/system/library/template/twig.php. - Go to line 39, which looks like this:
$this->loader = new \Twig\Loader\FilesystemLoader('/', $this->root);
- Modify this line to:
$this->loader = new \Twig\Loader\FilesystemLoader('./', $this->root);
By following these steps, you can ensure that OpenCart runs smoothly on InfinityFree hosting. Enjoy building your online store with OpenCart!


