Jump to content

I can't access config.php with include_once


fer987

Recommended Posts

Hi! I am new to PHP and I googled a lot before coming here.

 

I have trouble accessing localhost/community/admin/board_functions.php from a folder which path is localhost/community/boards/test/index.php, which script is the one below.

 

What path should I put on require_once to access the script?

 

Thanks in advance

 

<?php

require_once "..admin/board_functions.php";

$board_location = explode("\\", __DIR__);

$board_name = $board_location[5];

$board_title = board_title($board_name);

echo $board_title;

?>

Link to comment
Share on other sites

You're better off using absolute paths

 

require_once "/full/path/to/community/admin/board_functions.php";

 

Otherwise, you want

 

require_once "../../admin/board_functions.php";

 

You need a '../' for each branch you want to go down

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.