Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8706107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:32:02+00:00 2026-06-13T03:32:02+00:00

If I try to open this simple file in my Browser: <?php require_once ‘classes/settings.php’;

  • 0

If I try to open this simple file in my Browser:

<?php

require_once 'classes/settings.php';

class Mysql {
    
    private $conn;
    
    function __construct() {
        
        $this->conn = new mysqli (DB_SERVER,DB_USER,DB_PASSWORD,DB_MEMBER) or die('There was a problem connecting to the database.');
        if ($this->conn->connect_errno) {
echo "Failed to connect to MySQL: (" . $this->conn->connect_errno . ") " . $this->conn->connect_error;
}
 //echo $mysqli->host_info . "\n";
    }
    
    function verify_Username_and_Pass($un, $pwd) {
        
        $query = "SELECT *
        FROM users
        WHERE username = ? AND password = ?
        LIMIT 1";
        
        if($stmt = $this->conn->prepare($query)) {
            
            $stmt->bind_param('ss',$un,$pwd);
            $stmt->execute();
            
            if($stmt->fetch()) {    
                $stmt->close();
                return true;
            }
        }
    }
}
 ?>

I receive this warning error:

Warning: require_once(classes/settings.php): failed to open stream: No such file or 
directory in /var/www/classes/Mysql.php on line 3 Fatal error: require_once(): Failed 
opening required 'classes/settings.php' (include_path='.:/usr/share/php:/usr/share/pear') 
in /var/www/classes/Mysql.php on line 3

I can’t understand why, the file setting.php is in that folder, so what is the problem?


EDIT:

if I do the same this with another file for example this:

<?php 
require_once 'classes/settings.php';


 $host = "localhost";
 $user = "root";
 $pass = "pass";

 $databaseName = "membership";
 $tableName = "users";

 //--------------------------------------------------------------------------
 // 1) Connect to mysql database
 //--------------------------------------------------------------------------

 $con = mysql_connect($host,$user,$pass);
 $dbs = mysql_select_db($databaseName, $con);

 //--------------------------------------------------------------------------
 // 2) Query database for data
 //--------------------------------------------------------------------------
 $result = mysql_query("SELECT * FROM $tableName");            //query
 $array = mysql_fetch_row($result);                          //fetch result    

 //--------------------------------------------------------------------------
 // 3) echo result as json 
 //--------------------------------------------------------------------------
 echo json_encode($array);

?>

In this way, it works without problem, I can’t understand why the file and the path is right because in this second piece code all work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:32:03+00:00Added an answer on June 13, 2026 at 3:32 am

    Since you are with in the classes folder already you have two options

    First option is to use a relative path

    require_once 'settings.php';

    Second option is to use an absolute path

    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/settings.php'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try open and play .wav files with NAudio lib. private OpenFileDialog openFileDialog =
when I try to open a file for reading in my console application i
When I try to open a file in write mode with the following code:
Whenever I try to open a file with ifstream, it compiles fine, but will
I have this simple little batch file program that I wrote but it fails
I'll try and keep this simple, I have worked on projects in the past
I have the following PHP file which is used to send a simple email,
I wrote this simple script that reads a text file and then adds the
[EDIT] I try to open a file from a folder in my base directory.
I've this simple code: using(FileStream fs = new FileStream(@E:\test.bin, FileMode.Open, FileAccess.Read, FileShare.Read) { byte[]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.