Reply to Re: newbie: setting the page title

Your name:

Reply:


Posted by Jerry Stuckle on 05/27/05 02:34

Papa.Legba.666@gmail.com wrote:
> Thanks Dave.
>
> I wonde rif it is a server configuration probelm. When I try a path
> without http I get
>
> Warning: main(/layout/page_begin.php): failed to open stream: No such
> file or directory in /home/mysite/public_html/index2.php on line 1
>
> oh, sh*t !!!! it seems that I have to
> include('/home/mysite/public_html/layout/page_begin.php');
>
> what a weird setup!
>
> Surely an absoulte path should be /layout, not
> /home/mysite/public_html/layout/
>
> oh, well, at least I know now, and I would never have discovered it,
> had I not had to explain it to you.
>
> Thanx a 1,000,000
>

Yes and no. But it makes sense when you think about it...

/layout is the absolute path relative to the document root for the site
(/home/mysite/public_html). But /home/mysite/public_html/layout is the
absolute path to the file relative to the file system itself.

Using /layout is fine when you're accessing something through the web
server - the server automagically prepends the document root value to
the file name before making a call to the system.

However, PHP accesses the file system directory - it doesn't go through
the web server. So it doesn't prepend the document root to the
filename. So, if you just use /layout, it will look for the file in
/layout, instead of /home/mysite/public_html/layout.

The easiest way to handle it is to just prepend the document root
yourself. This will make the absolute path completely transparent, and
if you change web servers you can still access the file:

include($_SERVER['DOCUMENT_ROOT'] . '/layout/page_begin.php');

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация