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: 2,869
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
Staff
5,399 Points
2013-04-01 10:08 am EST
Hi RonaldGans,

Option 1: ../


To access a file / folder below your current directory, you can use ../

For example:

<?php include('../includes/file.php'); ?>

Option 2: Absolute Path


You can also use the absolute path, as in:

<?php include('/home/userna5/includes/file.php'); ?>

In the above example, you'll need to be sure to replace userna5 with your cPanel username.

I hope this helps!

Thanks,
- Brad

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

Like this Question?

Support Center Login

Social Media Login

   
Social Login Joomla

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

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!