Subdomain not working

Website URL

http://midamoc.free.nf

Error Message

This page isn’t working

midamoc.free.nf is currently unable to handle this request.

HTTP ERROR 500

Other Information

I have one main domain i.e. http://midamtech.free.nf which works perfectly fine. I’m using Wordpress in it. Whereas I have created subdomain i.e. midamoc.free.nf where I have installed Opencart but the subdomain throws above mentioned error.

Please read

3 Likes

Thanks for your reply Kang. Here is the error message I received.

Warning : require_once(): open_basedir restriction in effect. File(/home/vol15_3/infinityfree.com/if0_36452575/ocartdata/storage/vendor/aws/aws-sdk-php/src/functions.php) is not within the allowed path(s): (/php_sessions:/tmp:…:/var/www/errors:/usr/share/pear:/home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs) in /home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/system/vendor.php on line 11

Warning : require_once(/home/vol15_3/infinityfree.com/if0_36452575/ocartdata/storage/vendor/aws/aws-sdk-php/src/functions.php): Failed to open stream: Operation not permitted in /home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/system/vendor.php on line 11

Fatal error : Uncaught Error: Failed opening required ‘/home/vol15_3/infinityfree.com/if0_36452575/ocartdata/storage/vendor/aws/aws-sdk-php/src/functions.php’ (include_path=‘.:/usr/share/pear/’) in /home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/system/vendor.php:11 Stack trace: #0 /home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/system/framework.php(8): require_once() #1 /home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/index.php(20): require_once(‘/home/vol15_3/i…’) #2 {main} thrown in /home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/system/vendor.php on line 11

The problem seems to be with the .htaccess file, however I got no idea on what the problem is. Here is the contents from my .htaccess file.


php_value display_errors On
php_value mbstring.http_input auto
php_value date.timezone America/New_York
##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename .htaccess.txt (this file) to .htaccess
#
# For any support issues please visit: https://www.opencart.com
#
# The line 'Options +FollowSymLinks' may cause problems with some server configurations.
# It is required for the use of Apache mod_rewrite, but it may have already been set by
# your server administrator in a way that disallows changing it in this .htaccess file.
# If you encounter problems (e.g. site is not loading), comment out this line by adding a # in front
# FLOC is a feature suggested by Google, if this header shall not be set, disable the line
# having 'interest-cohort' by adding a # in front
##

## No directory listings
<IfModule mod_autoindex.c>
  IndexIgnore *
</IfModule>
## No-Referrer-Header
<IfModule mod_headers.c>
  Header set Referrer-Policy "no-referrer"
</IfModule>
## Suppress mime type detection in browsers for unknown types and prevent FLOC
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Permissions-Policy "interest-cohort=()"
</IfModule>
## Can be commented out if causes errors, see notes above.
Options +FollowSymlinks
## Prevent Directory listing
Options -Indexes
## Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>
## SEO URL Settings
RewriteEngine On
## If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
## Rewrite Rules
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css|svg)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
## Optional error documents
#ErrorDocument 400 /index.php?route=error/not_found
#ErrorDocument 401 /index.php?route=error/permission
#ErrorDocument 403 /index.php?route=error/not_found
#ErrorDocument 404 /index.php?route=error/not_found
#ErrorDocument 500 /index.php?route=error/not_found
#ErrorDocument 503 /index.php?route=error/not_found
## Additional Settings that may need to be enabled for some servers
## Uncomment the commands by removing the # sign in front of it.
## If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
# 7. disable open_basedir limitations
# php_admin_value open_basedir none

Please read

https://forum.infinityfree.com/search?q=open_basedir

2 Likes

Hi Kang, thanks for your prompt reply but the discussion you shared seems different to my query. In the discussion you shared the program seems to access the system log directory on root folder. While in my case its just trying to access the local files and folders.

Read again?

4 Likes

So, that basically means Opencart is not compatible with Infinityfree free account?

Read the guide. That’s a work around, but only when you are willing to go over the steps rather than asking the same question over and over again on the forum.

3 Likes

Hi Frank,
I have gone through all the discussions I have been redirected to, however I can only see temporary workouts not a permanent solution. Please do enlighten me if I have missed anything. Thank You

Hi Onepiece86,

I’ve viewed your topic and let’s start fresh as I’m do not want to clutter other attempts. We’ll start from the default status where you just have OpenCart freshly installed.

There are 2 issues you’re experiencing:

  1. OpenCart attempts to access folder stored externally to your hosting folder (not allowed)
  2. Wrong configuration in .htaccess

Simply put, open_basedir limits the scope that your application, i.e. OpenCart can access, it’s a security feature and it cannot be changed. Unfortunately the web root also cannot be changed as it’s fixed to /htdocs.

To solve this, you need to change the structure of your application a bit. OpenCart structures as 2 major folder: public and storage.

Move folders and files so that everything in the public folder immediately inside htdocs, then place the storage also in htdocs.

You should have a folder list under htdocs that looks something like admin + catalog + image + system and some other php files.

Then place the storage folder here in the htdocs folder.

Once that’s done, add a .htaccess file inside the storage folder with the following contents. This blocks public access to the storage folder.

Deny from all

Then in both /htdocs/config.php and /htdocs/admin/config.php, change the storage path to be the appropriate paths.

Specifically, you would want to change lines that looks like this and change it to:

define('DIR_STORAGE','/home/vol15_3/infinityfree.com/if0_36452575/midamoc.free.nf/htdocs/storage/');

If you notice paths that also contains /home/vol15_3/infinityfree.com/if0_36452575/ocartdata
Take note of those as they have to move to the following as well.
/home/vol15_3/infinityfree.com/if0_36452575/htdocs

This way your application can store data securely inside storage while not getting blocked by the security system.

I’ve also read the same guide as you did, but unfortunately that is not the proper solution and does not actually fix folder access issues, retrying would not yield anything.

Cheers,
Jason

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.