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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:32:13+00:00 2026-06-09T10:32:13+00:00

I am trying to use the require_once(); function in php, and it is causing

  • 0

I am trying to use the require_once(""); function in php, and it is causing a server error whenever it is used. I know I am using the correct path because I have checked my file directory many times and have been following a video tutorial as well when coding this php code. Any ideas to why I am getting this server error?

       <?php
            require_once("../../includes/session.php");
       ?>

The page calling this function is in a folder that shares folders – two sub-folders away from session.php if that makes sense.

This file is index.php, which is in public/admin. This page calling require_once is in public/admin/index.php, and the folder they both share is photo_gallery.

The error is: HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

All the debugging I have done is echo a hello statement before calling require_once and after require_once and when I posted hello after nothing was outputted

This is the error I receive when checking my error log:

[08-Aug-2012 11:01:04] PHP Parse error: syntax error, unexpected ‘{‘ in /home3/visittom/public_html/photo_gallery/includes/session.php on line 47

  • 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-09T10:32:15+00:00Added an answer on June 9, 2026 at 10:32 am

    require and include paths are relative to the file where they are declared, not necessarily the page that is loaded by the user. So if your index.php includes another page which contains the require_once you may run into problems.

    Also, check the web server error logs which should provide more detail about that 500 error.

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

Sidebar

Related Questions

I'm trying to use jquery with a simple php code: $('#some').click(function() { <?php require_once('some1.php?name=some'
I'm trying to use require_once to call Mail.php but when I create a new
I am trying to figure why I am getting this error. **Warning: require_once(\C\wamp\www\PHP with
I am trying to convert several php scripts to use the __autoload function. Right
I'm trying to develop a system using MySQL and PHP. I'm using mysqli* function
Im trying to use function that i put in remote server Now in testing
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying to use SimpleTest with CodeIgniter, using code supplied by maroonbytes .
I am trying to use PHPUnit with selenium I start the server java -jar

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.