Jump to content

../ help


Pyro4816

Recommended Posts

I'm pretty sure this has been answered, and it is just general knowledge that obviously i do not have.

 

I just moved to a server, and all of my pages using ../ to go back a directory are erroring out: saying the file doesn't exist. I know it exists, but unless I use the full exact web address, it will not function properly. Any ideas? Is there a setting in php or on the server to enable this??

 

Again sorry to ask here, but searching the forum for ../ is almost as useful as searching for the letter a, and Google.... well you get the idea. Thanks in advance.

Link to comment
Share on other sites

Error:

Warning: require_once(../includes/DbConnector.php) [function.require-once]: failed to open stream: No such file or directory in /home/pyro4816/public_html/Instal/instal3.php on line 9

 

line 8 and 9

<?PHP
require_once('../includes/DbConnector.php');

 

All the files are in the proper place, its just that the ../ isnt working properly on the server for some reason.

Link to comment
Share on other sites

Relative paths don't work the same way in PHP as they do in other languages.  Paths are tracked at runtime and are not relative to the executing script.

 

You can add and concatenate

dirname(__FILE__)

to your path instead in front of ../

 

Edit: mistyped.  You still need to change directories.

 

Anyway, I forgot about the new constant:

__DIR__

which is the same as the code given above (php 5.3+ only)

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.