GetDotted Domains

Viewing Thread:
"Relative vs Absolute paths in PHP"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Wed 30/10/02 at 11:15
Regular
Posts: 787
Guys Im getting an error when I use an absolute path in PHP

this works...


but this doesnt...



The error Im getting is: "Fatal error: Failed opening required '/required.php' (include_path='') in "

Is there way around this?
Thu 31/10/02 at 19:42
Regular
"Eff, you see, kay?"
Posts: 14,156
Yeah, it runs as an executable just like anything else, Apache just catches what it spews out.
Thu 31/10/02 at 11:24
Regular
""
Posts: 303
I'm not with Freeola but I get what you're trying to say.

PHP isnt my forte. Didn't realise PHP used the file system directory structure.
Thu 31/10/02 at 10:50
Regular
"It goes so quickly"
Posts: 4,083
Turbonutter wrote:
> How the hell is PHP supposed to know what your domain is? :)

'cus is suppose to be cleaver :oP

Anyway, say your Freeola ID is sr0123456, then your freeola web space root is /freeola/users/%/*/sr0123456/

Its a bit confusing here, but I'll give it a shot.

The '%' value is the last number in your ID, in this case 6.
The '*' value is the second from last number in your ID, in this case 5.

/freeola/users/6/5/sr0123456/ - being the root.
/freeola/users/6/5/sr0123456/htdocs - being your Web Space.
/freeola/users/6/5/sr0123456/cgi-shi - being your cgi-bin.

Confused yet :o)
Wed 30/10/02 at 19:03
Regular
"Eff, you see, kay?"
Posts: 14,156
Fool!

Explanation:

/foo.php in HTML is / in the domain, eg. www.mysite.com/foo.php

However, PHP runs on the filesystem as a program - /foo.php tries to look in the root directory for foo.php, kinda like C:\foo.php. Here:

+--={05:54:00}=--
| rob@euripides:~$ ls /
abyss c data etc initrd mnt rar tmp vmlinuz xmms
bin cdrom dev floppy lib proc root usr vmlinuz.old
boot d downloads home lost+found pub sbin var www
+--={05:54:01}=--
| rob@euripides:~$


See now? Your scripts will be somewhere in there somewhere, you have to find out what the "path to your root directory" is. In my setup, it's /www, on freeola's it's something massive like /var/apache/users/[your-userid]/htdocs/

How the hell is PHP supposed to know what your domain is? :)
Wed 30/10/02 at 12:00
Regular
"It goes so quickly"
Posts: 4,083
Oh, the root, sorry.

I'm sure there is an easier way of doing that, but its skicped my mind for the moment, but I'll look it up.

Suppose you could try setting up a Variable for the location of the root

$Root = "/home/html/public" or whatever your surver is set up as. Then just use:



but like I say, I'm sure that isn't the only way of doing it.

Rob might be able to answer this, but I'll go and have a look ...
Wed 30/10/02 at 11:50
Regular
""
Posts: 303
Changing it from


to


would mean its looking in the current directory, whereas I want it to look in the root.

And its a static filename Im using.

It's definately a PHP thing, as HTML works fine when you use this for hrefs etc.
Wed 30/10/02 at 11:33
Regular
"It goes so quickly"
Posts: 4,083
Just remove the / from the second one should do it, although I'm not sure why having it there would make an error.

Are you using a variable to put the name there, or a static name?

as in


or
Wed 30/10/02 at 11:15
Regular
""
Posts: 303
Guys Im getting an error when I use an absolute path in PHP

this works...


but this doesnt...



The error Im getting is: "Fatal error: Failed opening required '/required.php' (include_path='') in "

Is there way around this?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Many thanks!
You were 100% right - great support!
First Class!
I feel that your service on this occasion was absolutely first class - a model of excellence. After this, I hope to stay with Freeola for a long time!

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.