Jump to content

Recommended Posts

Posted

I tried including a PHP file from a different directory...

 

<?php include("../news.php");?>

 

Normal PHP includes work, however I cant get it to work if the file im trying to include is in a diff directory. Its in /forums/

 

Warning: include(../news.php) [function.include]: failed to open stream: No such file or directory in /home/user/public_html/index.php on line 150

 

Warning: include() [function.include]: Failed opening '../news.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/index.php on line 150

 

In need of assistance.

Posted

Your problem is probably not having the correct relative path to your include file."

 

Try adding the directory name to your path the include file is in.

 

<?php include("../files/news.php");?>

 

Or if your still confused just use the full path like this:

 

<?php

include("/home/byron/public_html/php/tools/sweeper.php");

?>

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...