Jump to content

[SOLVED] ../ gives problems


darksniperx

Recommended Posts

code:inside Feed.php

$language = 'en';
include_once '../lang/Feed_' .$language. '.php';

 

error:

Warning: showfeed(../lang/Feed_en.php) [function.showfeed]: failed to open stream: No such file or directory in /home/frdowd3/public_html/alex/alpha/forms/Feed.php on line 5

Warning: showfeed() [function.include]: Failed opening '../lang/Feed_en.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/frdowd3/public_html/alex/alpha/forms/Feed.php on line 5

 

directory structure:

alpha\
-forms\
          -Feed.php
-lang\
         -Feed_en.php

 

what can I do to fix the error, and I have checked all files are where they are suppose to be.

Link to comment
https://forums.phpfreaks.com/topic/76886-solved-gives-problems/
Share on other sites

A couple of things: When a file (say dir1/foo.php) is included into another file (say dir2/foo.php), the source must be relative too the foo.php in dir2. Second perhaps the server does not have permission to execute the file? And possibly third does the file exist?

Link to comment
https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389554
Share on other sites

Very Simple because include(); is a function it needs to be inside brackets:

Change

<?php
$language = 'en';
include_once '../lang/Feed_' .$language. '.php';
?>

To...

<?php
$language = 'en';
include_once ('../lang/Feed_' .$language. '.php');
?>

 

Link to comment
https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.