PHP absolute path problem...

Dave S EMAIL HIDDEN
Fri Mar 26 00:42:49 CET 2010


Ahh, I can't resist a PHP question before I go to bed!  :-)

It's been a while since I did any major PHP work, but when I did, I
always used absolute paths from the document root.  I also kept it as
simple as possible - no deeply nested include files, just one or two
directory levels and that's it.

Your server essentially appears to be telling you that the files don't
exist where it's expecting to find them. Does the location actually
exist? Do you have access to the location it's expecting to find them
in? (I expect it's probably "no" in at least one of these cases.)

What about making a file containing the phpinfo() function - that
usually tells you quite a lot of stuff. Perhaps there is a variable
set that you are unaware of, which is altering where the server is
expecting to find things?

Is there any reason you can't use absolute paths? I guess I don't know
really if it's the recommended approach (I vaguely remember Moron once
saying something about not doing it), but it's saved me loads of
headaches over the years.

Relative paths in PHP include files just seem to be too much of a pain
in the ass!

One more thought (vaguely related to a previous one):

Does the path "/srv/www/htdocs/home/stud09/data1/STUDF/M09K0054/public_html/032289/web3/inl2/_includes/"
actually exist? Because it seems a pretty unlikely one to me! (Open up
a terminal window and find out!)

Perhaps you can drop your whole $serverPath thing and just use
$folderPath, because I'm not exactly sure what it is you're trying to
do by combining the two. They seem unrelated to me (referring to two
different points on the file system), but maybe I've misunderstood
what it is you're trying to do.

You've specified the location of your user's files in your $folderPath
variable - which on most UNIX type file systems is going to be under
/home - and then you've also bunged the server's PHP document root in
there too. I think the two are unrelated, and you're most likely to
just want one or the other. Try dropping the $serverPath stuff out and
see what happens.

HTH somehow!

Cheers,

~Dave

On 25 March 2010 22:19, Mikael Hansson <forums at deadmengods.com> wrote:
> Hi!
> I'm currently studying PHP and I've run into a problem when putting an
> exercise on my school account.
> [...]
> Does anyone have any clue to what can be the cause?
> /Micke



More information about the music-bar mailing list