By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

./ on server?

P: 51
I recently developed a website for my school. I was working off localhost for the development. When time came to upload the server we had didn't accept "./" or "../" as soft paths. Am I doing something wrong? Is there anyway to solve this?

Thanks.
Sep 26 '08 #1
Share this Question
Share on Google+
7 Replies


P: 51
If I'm on a windows server do I have to use ".\" instead of "./"? Just a thought...
Sep 26 '08 #2

ak1dnar
Expert 100+
P: 1,584
Could you please explain "soft paths" ?
Are you talking about relative path? give some example links (Image,File) which is not working in your HTML/PHP codes.
Sep 26 '08 #3

nathj
Expert 100+
P: 938
If I'm on a windows server do I have to use ".\" instead of "./"? Just a thought...
If you mean relative paths so using '../' to go back up the directory tree and then adding the rest of the path to come down the tree you should be able to use either '/' or '\' for Windows - it sorts it out for you - I think.

If it's *nix box then you need to use '/'.

So I recommend you use '/' as that should work regardless of server OS. To give an example if you have a site 'www.myschool.com' and you want to go to the images directory you could do so with 'image'mypicture.jpg' to get that file.

If you are in a sub directory say 'www.myschool.com/pages/classes.php' and you want to get an image from the image directory, which is at the same level as the pages directory then '../image/classpicture.jpg' should do the trick.

It is definitely a double'.' to go back up the tree though. The simple solution might be to use absolute paths rather than relative ones anyway.

Cheers
nathj
Sep 26 '08 #4

P: 51
I'm doing "is_dir('./blogs')" and it's returning false.
Sep 26 '08 #5

Markus
Expert 5K+
P: 6,050
I'm doing "is_dir('./blogs')" and it's returning false.
Say you are currently in a file (www/dir1/dir2/dir3/test.php) this file has been included by www/dir1/dir2/startup.php and this has been included by www/dir1/run.php

Using './' in test.php will then refer to www/dir/
'./' takes you to where the 'parent' file is.

Just to clear up any confusion. So make sure there is a directory called 'blogs' whereever your php script starts.
Sep 26 '08 #6

P: 51
This all works when I run on localhost. Would it be different on the server?
Sep 26 '08 #7

P: 51
Ok strike that, I've fixed that problem, but now I have another. I can't read or write files on the server. I'm assuming that the permissions just aren't letting me, but I think my server doesn't support chmod. Should I just look for a new server, or is there a way around this?
Sep 27 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.