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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:29:18+00:00 2026-06-02T16:29:18+00:00

Background info: I’ve been developing a self hosted Facebook app on my own server

  • 0

Background info:
I’ve been developing a self hosted Facebook app on my own server (localhost) and have everything all working. Recently, I uploaded my files to my shared hosting online server (hostgator) and an odd bug popped up.

My require_once() functions seem to ignore relative paths on the hostgator server. For example, in index.php, I have require_once(‘fb/login.php’). This throws an error, stating that the file at example.com/login.php cannot be found. Why does require() ignore the fb part of my path? Remember, this works perfectly fine on my private localhost server.
I did some Googling and solved half the problem by going into php.ini and turning on include_path=”.:”. This got rid of the first error, but now login.php also has require_once(‘fb/sdk/Facebook.php’) and cannot locate that file. I understand that it gets messy with nested requires, but this does work on my localhost server.
Both servers are PHP5, and I have made sure that the php.ini files are similar. By default, the localhost php.ini has include_path commented. I have even gone as far to replace the online php.ini file with my localhost one. Still, nothing.
I have tried using absolute paths, and they do work, but I have many includes and requires throughout my code and do not want to hand code every single path. Any insight? This is a really infuriating problem and I hope there is an easy solution.

Thank you!


Well I did a ton of research and ended up using $_SERVER[‘DOCUMENT_ROOT’].’fb/login.php’ as my path for all of my requires and includes. Fixed all of my problems, thank god

  • 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-02T16:29:23+00:00Added an answer on June 2, 2026 at 4:29 pm

    I stopped using relative paths a long time ago to avoid the kind of troubles you are going through now. Consider doing like all PHP frameworks do – they define a variable that indicates where exactly is the root of the server, then you can use that to build absolute paths to your files.

    You can do that by adding this to you root index.php file:

    define('DOCROOT', realpath(dirname(__FILE__)).'/');
    

    Then it’s just a matter of going through all your require statements and adding DOCROOT first:

    require_once('fb/login.php');
    

    becomes:

    require_once(DOCROOT . 'fb/login.php');
    

    You can even do a global search and replace by replacing require_once(' with require_once(DOCROOT . '

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

Sidebar

Related Questions

Background info: I have some WCF services that are hosted on an internal server
Here's some background info. I have three MySQL tables (all InnoDB). The first table
Background info I have an app where users can make microsites ala http://myname.the_app.com .
Please help! Background info I have a WPF application which accesses a SQL Server
Background Info Developing with Windows Azure and WCF RIA Services, I have seen a
Background info: Over the past week, I have been messing around with Chrome extensions
Background Info: I have two COM+ components on a remote server, based on .NET
Background info: I have a windows application (in c#) that handles a custom file
Background Info: I have a large body of text that I regularly encapsulate in
Giving a little background info: Details.cshtml contains a title (uses model Category), I have

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.