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 6235233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:38:06+00:00 2026-05-24T10:38:06+00:00

I got a problem with this: I got file xxx.php in which I’m parsing

  • 0

I got a problem with this:

I got file xxx.php in which I’m parsing one file: $config[‘etc’] = parse_ini_file(‘config/config.txt’);

Everything is fine, until I’m including xxx.php file to my yyy.php file using require_once("lang.inc.php");

Then I get an message: Warning: parse_ini_file(config/config.txt): failed to open stream: No such file or directory in …

When I change ;

$config[‘etc’] = parse_ini_file(‘config/config.txt’);

to

$config[‘etc’] = parse_ini_file(‘../config/config.txt’);

then my yyy.php works fine, but xxx.php not… and I’m in stuck.

Help me guys, please.

  • 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-05-24T10:38:07+00:00Added an answer on May 24, 2026 at 10:38 am

    Try using absolute file paths if your PHP scripts can be invoked (or requested) from different directories. For example, the current directory of a PHP script executed under example.com/one.php will be different from example.com/folder/two.php.

    Your change to

    $config['etc'] = parse_ini_file('../config/config.txt');
    

    is still relative, except this time it’s just “one directory up from the current directory > config > config.txt”, rather than before, where you were looking in the same current directory.

    A generic fix would be to do the following:

    $root = $_SERVER['DOCUMENT_ROOT'];
    // ... code ...
    $config['etc'] = parse_ini_file($root . '/config/config.txt');
    

    There are possible issues with using the DOCUMENT_ROOT field, but it should be fine for the most part (such as DOCUMENT_ROOT not being defined under the CLI). Also, check if DOCUMENT_ROOT has a trailing slash, even though the standard is not to have it, some hosts may have the trailing slash included. If it does, remove your slash at the beginning of your file path.

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

Sidebar

Related Questions

I've got the following problem - This is my log4j config file: log4j.rootLogger=info, stdout,
I've got a problem with one of the pages within a website. This page
I have a PHP program that encrypts a PDF file into .xxx file this
I got a problem similar to this one: FileSystemWatcher - only the change event
I got a problem like this (this is html/css menu): Eshop | Another eshop
I got a problem with this linq query: from PersistedFileInfo fi in m_Database from
I've got a problem with this embed in Safari. It works just fine on
I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service
I've got this nasty problem where sending multiple, large messages in quick succession from
I’ve got this strange problem whereby the content within a scroll viewer increases in

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.