InMotion Hosting Support Center

How do I access files below / outside of public_html using php?

Category: How To

RonaldGans
Asked:
2013-03-31 1:20 am EST

Hits: 7,222
For my web site, my public directory is /public_html . BUT my line:
<?php include('includes/file.php'); ?>
fails because php cannot open the stream file.php. "includes" is off of public_html.

RON

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

BradM
5,399 Points
2013-04-01 10:08 am EST
Hi RonaldGans,
<h2>Option 1: ../</h2>
To access a file / folder below your current directory, you can use ../

For example:

<div class='code_block'>&lt;?php include('<span style='color:red;'>../</span>includes/file.php'); ?&gt;</div>
<h2>Option 2: Absolute Path</h2>
You can also use the absolute path, as in:

<div class='code_block'>&lt;?php include('<span style='color:red;'>/home/userna5/</span>includes/file.php'); ?&gt;</div>
In the above example, you'll need to be sure to replace userna5 with <a href='http://www.inmotionhosting.com/support/website/how-to/viewing-account-technicial-information-in-amp'>your cPanel username</a>.

I hope this helps!

Thanks,
- Brad

You must login before you can post a comment about this answer.

Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

   
Social Login Joomla

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!