OpenCart is a free and open-source PHP-based online e-commerce solution. It’s a hugely popular and powerful option to build an online store. In free hosting, there are some necessary steps to follow to install OpenCart and ensure it runs smoothly.
You will need to install OpenCart through the Softaculous App Installer. You can click on the Softaculous Installer button on your hosting information screen.
Then the Softaculous interface should open.
Search for OpenCart in the Softaculous interface
Configuring the Data Directory [Important]
For the OpenCart software to run smoothly you will need to modify the default data directory value in Softaculous. By default it will be: ocartdata
This default path will not work on our free hosting service because we do not allow access to files outside the htdocs directory.
To resolve this issue, you will need to find the path, your website is hosted on.
You need to go to your Hosting Information page, Then go to the Domains Section and find the “Path” for the domain name you are using.
If I was trying to install Open Cart on the first domain name opencart.iceiy.com
I need to use htdocs/ocartdata
as the data directory
If I was trying to install OpenCart on the second domain name opencartexample.iceiy.com
I need to use opencartexample.iceiy.com/htdocs/ocartdata
as the data directory
You will need to change the value of the data directory to [Path]/ocartdata
Then you can click on Install to Install OpenCart.
How to fix the open_basedir error?
There seems to be a bug related to the open_basedir configuration on Opencart 4.0.2.3 on our free hosting platform. You might notice an error message 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/volxx_x/iceiy.com/icei_xxxxxxxx/htdocs) in /home/volxx_x/iceiy.com/icei_xxxxxxxx/htdocs/ocartdata/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 91The "/" directory does not exist ("/").: in /home/volxx_x/iceiy.com/icei_xxxxxxxx/htdocs/ocartdata/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 92
This issue should be fixed in the newer versions of OpenCart. Fortunately, you can also fix it manually.
To fix this issue,
Open your file manager,
Find the file at: htdocs/system/library/template/twig.php
Navigate to Line 39,
Modify this line to the specified:
$this->loader = new \Twig\Loader\FilesystemLoader('./', $this->root);
Your Installation of OpenCart should now run smoothly on our free hosting.
Happy Building 🫶
Discussion
If you are facing any issues with the guide or want help somewhere, you can discuss it with us or the community on our forum page.