# Problem Loading the website with error 403 forbidden

**URL:** <https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475>\
**Category:** Hosting Support\
**Created:** [January 9, 2024, 4:34pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475 "2024-01-09T16:34:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 4:34pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/1 "2024-01-09T16:34:10Z")

</div>

### Website URL: [http://lecplems.infinityfreeapp.com/](http://lecplems.infinityfreeapp.com/)

### Error Message

# 403 Forbidden

### Other Information

I am new in this website hosting, i have uploaded all the files and create the index.php as htdocs/leave\_system/index.php.  
please help to resolve the problem

---

<div class="post-metadata">

**Author:** ![Herbert](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/herbert/32/43603_2.png) [@Herbert](https://forum.infinityfree.com/u/Herbert)\
**Post date:** [January 9, 2024, 4:35pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/2 "2024-01-09T16:35:51Z")

</div>

You can’t put a index file inside of a folder like that. Main file should be inside of the htdocs folder.

---

<div class="post-metadata">

**Author:** ![Herbert](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/herbert/32/43603_2.png) [@Herbert](https://forum.infinityfree.com/u/Herbert)\
**Post date:** [January 9, 2024, 4:37pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/3 "2024-01-09T16:37:03Z")

</div>

Put your index.php file in the htdocs folder. It should fix the issue

---

<div class="post-metadata">

**Author:** ![anon90933456](https://forum.infinityfree.com/letter_avatar/anon90933456/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon90933456](https://forum.infinityfree.com/u/anon90933456)\
**Post date:** [January 9, 2024, 4:37pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/4 "2024-01-09T16:37:13Z")

</div>

Hi and welcome to the forum! If you want your website to show up as main page, please move the files outside the folder you uploaded/created while still keeping them on your `htdocs` folder, else it would be accessible on `yourdomain/folderyoucreated/`. Also, when I tried to access the actual index inside that folder, I get a HTTP ERROR 500:

> [@Http error 500](https://forum.infinityfree.com/docs?topic=49352):
>
> When trying to access your website, you may see a page which returns the status code “500”. In Google Chrome, you’ll see a page with the error code HTTP ERROR 500. There are typically two reasons which can cause this error: The PHP code has crashed. The .htaccess file contains invalid rules. Here are some things you can try to debug and fix this. Fixing crashing PHP code A HTTP ERROR 500 simply tells you that the PHP code has crashed, but gives no information as to why it has crashed. Gett…

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 5:22pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/5 "2024-01-09T17:22:44Z")

</div>

### Website URL: [http://lecplems.infinityfreeapp.com/](http://lecplems.infinityfreeapp.com/)

(please specify the URL of the site on which you are experiencing the problem)

### Error Message

**Warning** : require\_once(classes/DBConnection.php): Failed to open stream: No such file or directory in **/home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/config.php** on line **8**

**Fatal error** : Uncaught Error: Failed opening required ‘classes/DBConnection.php’ (include\_path=‘.:/usr/share/pear/’) in /home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/config.php:8 Stack trace: #0 /home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/index.php(1): require\_once() #1 {main} thrown in **/home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/config.php** on line **8**

### Other Information

getting this error please help me resolve…i am new in this field

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 5:46pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/6 "2024-01-09T17:46:12Z")

</div>

i have resolved the warning error but how to resolve fatal error please support

---

<div class="post-metadata">

**Author:** ![anon90933456](https://forum.infinityfree.com/letter_avatar/anon90933456/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon90933456](https://forum.infinityfree.com/u/anon90933456)\
**Post date:** [January 9, 2024, 5:59pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/7 "2024-01-09T17:59:28Z")

</div>

You’ll have to make sure you also uploaded the remaining files on the `htdocs` folder. Only creating an index.php isn’t enough.

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 6:00pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/8 "2024-01-09T18:00:00Z")

</div>

thank you

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 6:01pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/9 "2024-01-09T18:01:14Z")

</div>

i have done the same but still getting the fatal error

---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [January 9, 2024, 6:01pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/10 "2024-01-09T18:01:24Z")

</div>

> **Fatal error** : Uncaught Error: Undefined constant “sql105” in /home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/classes/SystemSettings.php:136 Stack trace: #0 /home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/config.php(9): require\_once() #1 /home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/index.php(1): require\_once(‘/home/vol1\_7/in…’) #2 {main} thrown in **/home/vol1\_7/infinityfree.com/if0\_35744353/htdocs/classes/SystemSettings.php** on line **136**

go to this location `/classes/SystemSettings.php` and copy the source of this file

paste the code on the forum, but first **hide all sensitive data** or write something like paswswwddd, uuusername instead of real data

and then select it all and choose code formatting

![image](https://forum-cdn.infinityfree.net/original/3X/4/3/4384c819e09007175e4aae2757fa1306fa68888b.png)

last = publish a post

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 6:10pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/11 "2024-01-09T18:10:17Z")

</div>

```auto
<?php
if(!class_exists('DBConnection')){
	require_once('../config.php');
	require_once('DBConnection.php');
}
class SystemSettings extends DBConnection{
	public function __construct(){
		parent::__construct();
	}
	function check_connection(){
		return($this->conn);
	}
	function load_system_info(){
		// if(!isset($_SESSION['system_info'])){
			$sql = "SELECT * FROM system_info";
			$qry = $this->conn->query($sql);
				while($row = $qry->fetch_assoc()){
					$_SESSION['system_info'][$row['meta_field']] = $row['meta_value'];
				}
		// }
	}
	function update_system_info(){
		$sql = "SELECT * FROM system_info";
		$qry = $this->conn->query($sql);
			while($row = $qry->fetch_assoc()){
				if(isset($_SESSION['system_info'][$row['meta_field']]))unset($_SESSION['system_info'][$row['meta_field']]);
				$_SESSION['system_info'][$row['meta_field']] = $row['meta_value'];
			}
		return true;
	}
	function update_settings_info(){
		$data = "";
		foreach ($_POST as $key => $value) {
			if(!in_array($key,array("about_us","privacy_policy")))
			if(isset($_SESSION['system_info'][$key])){
				$value = str_replace("'", "&apos;", $value);
				$qry = $this->conn->query("UPDATE system_info set meta_value = '{$value}' where meta_field = '{$key}' ");
			}else{
				$qry = $this->conn->query("INSERT into system_info set meta_value = '{$value}', meta_field = '{$key}' ");
			}
		}
		if(isset($_POST['about_us'])){
			file_put_contents('../about.html',$_POST['about_us']);
		}
		if(isset($_POST['welcome_content'])){
			file_put_contents('../welcome_content.html',$_POST['welcome_content']);
		}
		if(isset($_FILES['img']) && $_FILES['img']['tmp_name'] != ''){
			$fname = 'uploads/'.strtotime(date('y-m-d H:i')).'_'.$_FILES['img']['name'];
			$move = move_uploaded_file($_FILES['img']['tmp_name'],'../'. $fname);
			if(isset($_SESSION['system_info']['logo'])){
				$qry = $this->conn->query("UPDATE system_info set meta_value = '{$fname}' where meta_field = 'logo' ");
				if(is_file('../'.$_SESSION['system_info']['logo'])) unlink('../'.$_SESSION['system_info']['logo']);
			}else{
				$qry = $this->conn->query("INSERT into system_info set meta_value = '{$fname}',meta_field = 'logo' ");
			}
		}
		if(isset($_FILES['cover']) && $_FILES['cover']['tmp_name'] != ''){
			$fname = 'uploads/'.strtotime(date('y-m-d H:i')).'_'.$_FILES['cover']['name'];
			$move = move_uploaded_file($_FILES['cover']['tmp_name'],'../'. $fname);
			if(isset($_SESSION['system_info']['cover'])){
				$qry = $this->conn->query("UPDATE system_info set meta_value = '{$fname}' where meta_field = 'cover' ");
				if(is_file('../'.$_SESSION['system_info']['cover'])) unlink('../'.$_SESSION['system_info']['cover']);
			}else{
				$qry = $this->conn->query("INSERT into system_info set meta_value = '{$fname}',meta_field = 'cover' ");
			}
		}
		
		$update = $this->update_system_info();
		$flash = $this->set_flashdata('success','System Info Successfully Updated.');
		if($update && $flash){
			// var_dump($_SESSION);
			return true;
		}
	}
	function set_userdata($field='',$value=''){
		if(!empty($field) && !empty($value)){
			$_SESSION['userdata'][$field]= $value;
		}
	}
	function userdata($field = ''){
		if(!empty($field)){
			if(isset($_SESSION['userdata'][$field]))
				return $_SESSION['userdata'][$field];
			else
				return null;
		}else{
			return false;
		}
	}
	function set_flashdata($flash='',$value=''){
		if(!empty($flash) && !empty($value)){
			$_SESSION['flashdata'][$flash]= $value;
		return true;
		}
	}
	function chk_flashdata($flash = ''){
		if(isset($_SESSION['flashdata'][$flash])){
			return true;
		}else{
			return false;
		}
	}
	function flashdata($flash = ''){
		if(!empty($flash)){
			$_tmp = $_SESSION['flashdata'][$flash];
			unset($_SESSION['flashdata']);
			return $_tmp;
		}else{
			return false;
		}
	}
	function sess_des(){
		if(isset($_SESSION['userdata'])){
				unset($_SESSION['userdata']);
			return true;
		}
			return true;
	}
	function info($field=''){
		if(!empty($field)){
			if(isset($_SESSION['system_info'][$field]))
				return $_SESSION['system_info'][$field];
			else
				return false;
		}else{
			return false;
		}
	}
	function set_info($field='',$value=''){
		if(!empty($field) && !empty($value)){
			$_SESSION['system_info'][$field] = $value;
		}
	}
}
$_settings = new SystemSettings();
$_settings->load_system_info();
$action = !isset($_GET['f']) ? 'none' : strtolower($_GET['f']);
$sysset = new SystemSettings();
switch ($action) {
	case 'update_settings':
		echo $sysset->update_settings_info();
		break;
	default:
		// echo $sysset->index();
		break;
}
?>

```

---

<div class="post-metadata">

**Author:** ![Herbert](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/herbert/32/43603_2.png) [@Herbert](https://forum.infinityfree.com/u/Herbert)\
**Post date:** [January 9, 2024, 6:13pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/12 "2024-01-09T18:13:02Z")

</div>

I think you need to check your DBConnection.php file. There’s nothing wrong with the code you provided. It’s either caused by DBConnection.php or config.php

---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [January 9, 2024, 6:17pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/13 "2024-01-09T18:17:06Z")

</div>

![image](https://forum-cdn.infinityfree.net/original/3X/9/9/99bec1e8ff24c62adb759da37af6fcd058955426.png)

It looks like you have all the paths mixed up and in the wrong places  
or incomplete upload

Please upload everything again and pay attention that all the files are where they should be

* * *

This way we just jump from one problem to another, and I think it’s simpler to upload everything again

And tell us what your website actually does?  
what is it about? I’m asking in the sense that maybe you don’t try to fix it if it’s an API for mobile apps and the like because this is hosting exclusively for websites

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 6:21pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/14 "2024-01-09T18:21:54Z")

</div>

```auto
<?php
if(!defined('DB_SERVER')){
    require_once("../initialize.php");
}
class DBConnection{

    private $host = DB_SERVER;
    private $username = DB_USERNAME;
    private $password = DB_PASSWORD;
    private $database = DB_NAME;
    
    public $conn;
    
    public function __construct(){

        if (!isset($this->conn)) {
            
            $this->conn = new mysqli($this->host, $this->username, $this->password, $this->database);
            
            if (!$this->conn) {
                echo 'Cannot connect to database server';
                exit;
            }            
        }    
        
    }
    public function __destruct(){
        $this->conn->close();
    }
}
?>

```

---

<div class="post-metadata">

**Author:** ![Herbert](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/herbert/32/43603_2.png) [@Herbert](https://forum.infinityfree.com/u/Herbert)\
**Post date:** [January 9, 2024, 6:26pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/15 "2024-01-09T18:26:50Z")

</div>

This code is not responsible for the error it is causing. Like @Oxy mentioned you are going to have to reupload every file with the correct order. We can’t be exactly sure what’s causing the issue since there are too many files included in your project. But anyway, check your project file for `sql105 constant`.

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 6:31pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/16 "2024-01-09T18:31:19Z")

</div>

my database host name is **[sql105.infinityfree.com](http://sql105.infinityfree.com)** other than this i have not found sql105 anywhere…is this creating the issue

---

<div class="post-metadata">

**Author:** ![Herbert](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/herbert/32/43603_2.png) [@Herbert](https://forum.infinityfree.com/u/Herbert)\
**Post date:** [January 9, 2024, 6:34pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/17 "2024-01-09T18:34:46Z")

</div>

No it’s not. The error you are seeing is caused because PHP trying to use the constant `sql105` , but it cannot find a definition for it.

---

<div class="post-metadata">

**Author:** ![Herbert](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/herbert/32/43603_2.png) [@Herbert](https://forum.infinityfree.com/u/Herbert)\
**Post date:** [January 9, 2024, 6:36pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/18 "2024-01-09T18:36:28Z")

</div>

Are you certain you’ve provided the whole code of the **SystemSettings.php** file? Because the error is causing inside of that file.

---

<div class="post-metadata">

**Author:** ![anon90933456](https://forum.infinityfree.com/letter_avatar/anon90933456/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon90933456](https://forum.infinityfree.com/u/anon90933456)\
**Post date:** [January 9, 2024, 6:38pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/19 "2024-01-09T18:38:47Z")

</div>

I’ve also checked the stack traces and the OP might need to check either `config.php` or `initialize.php` placed both on the `htdocs` folder.

@rahulkast, can you please also share the contents of either those two files I’ve listed to see where is the problem?

---

<div class="post-metadata">

**Author:** ![rahulkast](https://forum.infinityfree.com/letter_avatar/rahulkast/32/5_5575768a8748004e209b776fc1b2916d.png) [@rahulkast](https://forum.infinityfree.com/u/rahulkast)\
**Post date:** [January 9, 2024, 6:45pm UTC](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475/20 "2024-01-09T18:45:41Z")

</div>

here is the config.php code

```auto
<?php
ob_start();
ini_set('date.timezone','Asia/Manila');
date_default_timezone_set('Asia/Manila');
session_start();

require_once('initialize.php');
require_once('classes/DBConnection.php');
require_once('classes/SystemSettings.php');
$db = new DBConnection;
$conn = $db->conn;

function redirect($url=''){
	if(!empty($url))
	echo '<script>location.href="'.base_url .$url.'"</script>';
}
function validate_image($file){
	if(!empty($file)){
			// exit;
		if(is_file(base_app.$file)){
			return base_url.$file;
		}else{
			return base_url.'dist/img/no-image-available.png';
		}
	}else{
		return base_url.'dist/img/no-image-available.png';
	}
}
function isMobileDevice(){
    $aMobileUA = array(
        '/iphone/i' => 'iPhone', 
        '/ipod/i' => 'iPod', 
        '/ipad/i' => 'iPad', 
        '/android/i' => 'Android', 
        '/blackberry/i' => 'BlackBerry', 
        '/webos/i' => 'Mobile'
    );

    //Return true if Mobile User Agent is detected
    foreach($aMobileUA as $sMobileKey => $sMobileOS){
        if(preg_match($sMobileKey, $_SERVER['HTTP_USER_AGENT'])){
            return true;
        }
    }
    //Otherwise return false..  
    return false;
}
ob_end_flush();
?>

```

[Next page](https://forum.infinityfree.com/t/problem-loading-the-website-with-error-403-forbidden/88475.md?page=2)
