Fmdpa Posted February 23, 2011 Share Posted February 23, 2011 Ok, I'm stumped. I have a file in a subdirectory of my public root directory. I need to access a file in the public root directory. Just stating the filename worked on my Windows localhost. But it isn't working on my Unix host. These are things I've tried, none successful: require '../my_file.php';require dirname(__FILE__) . '/../my_file.php'; Link to comment Share on other sites More sharing options...
Ingolme Posted February 23, 2011 Share Posted February 23, 2011 Are you getting any error messages?See if you need to set folder permissions to allow the access. Link to comment Share on other sites More sharing options...
Fmdpa Posted February 24, 2011 Author Share Posted February 24, 2011 It doesn't look like it's a permissions problem. Yes, I'm getting an error:PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/public_html/connect.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/[ username ]/public_html/inserts/foot.php[/i] on line 139 Link to comment Share on other sites More sharing options...
Synook Posted February 24, 2011 Share Posted February 24, 2011 Is the file actually at /public_html/connect.php? Is the public_html directory really in the system root? Link to comment Share on other sites More sharing options...
Fmdpa Posted February 24, 2011 Author Share Posted February 24, 2011 The file is at that location, but public_html is not in the system root. It is just the website root. Link to comment Share on other sites More sharing options...
boen_robot Posted February 24, 2011 Share Posted February 24, 2011 What is dirname(__FILE__) ?var_dump... Link to comment Share on other sites More sharing options...
Fmdpa Posted February 24, 2011 Author Share Posted February 24, 2011 /home/username/public_html/inserts Link to comment Share on other sites More sharing options...
boen_robot Posted February 24, 2011 Share Posted February 24, 2011 Wha... and require dirname(__FILE__) . '/../connect.php'; failed?!? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 24, 2011 Share Posted February 24, 2011 require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'my_file.php'; Link to comment Share on other sites More sharing options...
Fmdpa Posted February 25, 2011 Author Share Posted February 25, 2011 It actually looks like that wasn't the cause of the problem, as I thought it was. Thanks for your replies anyway, however! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.