# How to install OpenCart on InfinityFree

**URL:** https://forum.infinityfree.com/t/how-to-install-opencart-on-infinityfree/96859
**Category:** Websites and PHP
**Created:** [August 2, 2024, 2:16pm UTC](https://forum.infinityfree.com/t/how-to-install-opencart-on-infinityfree/96859 "2024-08-02T14:16:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)
#### Post date: [August 2, 2024, 2:16pm UTC](https://forum.infinityfree.com/t/how-to-install-opencart-on-infinityfree/96859/1 "2024-08-02T14:16:23Z")

</div>

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`:

![image](https://forum.infinityfree.com/images/transparent.png)

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:

1. Check your domain directory:

2. Modify the Data Directory in Softaculous:

![image](https://forum.infinityfree.com/images/transparent.png)

## 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:

```auto
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](https://github.com/opencart/opencart/commit/557f14d908c37b3dc49864d202a9981fd26eb676) in the OpenCart repository, but the fix has not yet been released. Fortunately, you can easily apply the fix manually.

To do this:

1. Access the File Manager.
2. Locate the file at `htdocs/system/library/template/twig.php`.
3. Go to line 39, which looks like this:

```auto
$this->loader = new \Twig\Loader\FilesystemLoader('/', $this->root);

```

1. Modify this line to:

```auto
$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!
