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
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
Share on other sites

The brackets are not required, I have tested this myself before.

 

Now, back to the question at hand.

darksniperx, Try using the absolute path of that file.

Example:

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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