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

  • Home
  • SEARCH
  • 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 6530935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:48:59+00:00 2026-05-25T09:48:59+00:00

I got a problem about including a included file in PHP. Project functions(folder) has

  • 0

I got a problem about including a included file in PHP.

Project

  • functions(folder) has a.php
  • xml(folder) has b.xml
  • index.php

This is my project structure(sorry about that, I can’t post images).
I try to use “index.php” to include “a.php” while “a.php” is using “b.xml“

this is what i did on XAMPP and it works perfectly:

in index.php I wrote: include ‘functions/a.php’;

in a.php I wrote: $xml->load(‘xml/b.xml’);

However if I copy these to my Uni’s apache server, it can’t open this b.xml.
This is not permission because when i change to absolute path it works…

Thank you guys in advance:-)

  • 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-25T09:49:00+00:00Added an answer on May 25, 2026 at 9:49 am

    in a.php you should refer to ../xml/b.xml if you use include
    thing is, it depeneds on when $xml->load() is defined. if it’s your own code then put the path relative to the definition. otherwise “../xml/b.xml” should work.

    you can always to $_SERVER[‘DOCUMENT_ROOT’], but i myself like defining directories as constants (with absolute path) and using them around the project.

    define('DIR_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/');
    define('DIR_FUNCTIONS', DIR_ROOT . 'functions/');
    define('DIR_XML', DIR_ROOT . 'xml/');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've hit an annoying problem in LaTeX. I've got a tex file of about
I got a problem about how to reverse a string containing this 'abcd汉字efg'. str_to_reverse
I've got a problem about onbeforeunload recently that I need to pop up a
I have got a strange problem about in_array recently which I cannot understand. e.g.
I have got a performance problem about TextField.htmlText +=msg .And I know that TextField.appendText(msg)
I got a problem like this (this is html/css menu): Eshop | Another eshop
I've got a problem about RegOpenKeyEx, the code: #include <tchar.h> #include <stdio.h> #include <windows.h>
Got a little problem i asked about it before but maybe i didnt ask
Reading about how Google solves the translation problem got me thinking. Would it be
I've got a problem that I'm rather confused about. I have the following lines

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.