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
You canât put a index file inside of a folder like that. Main file should be inside of the htdocs folder.
4 Likes
Put your index.php file in the htdocs folder. It should fix the issue
5 Likes
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:
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âŚ
6 Likes
(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
i have resolved the warning error but how to resolve fatal error please support
Youâll have to make sure you also uploaded the remaining files on the htdocs
folder. Only creating an index.php isnât enough.
5 Likes
i have done the same but still getting the fatal error
Oxy
January 9, 2024, 6:01pm
10
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
last = publish a post
5 Likes
<?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("'", "'", $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;
}
?>
1 Like
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
4 Likes
Oxy
January 9, 2024, 6:17pm
13
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
6 Likes
<?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();
}
}
?>
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
.
4 Likes
my database host name is sql105.infinityfree.com other than this i have not found sql105 anywhereâŚis this creating the issue
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.
2 Likes
Are you certain youâve provided the whole code of the SystemSettings.php file? Because the error is causing inside of that file.
2 Likes
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?
5 Likes
here is the config.php code
<?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();
?>