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

Get get include pages to work...

P: n/a
Greetings,
I have the following:

require_once($_SERVER["DOCUMENT_ROOT"]."/virtuals/doc-root.php4");

I also have several more include and include once that pull various
sections into my main page. I am trying to get this working on a local
machine for testing purposes. I have (windwos) Apache and PHP set up
on my machine and have written several test pages to confirm things
are working. When I perform an echo of the Document_root and
global_root I get the following:

server doc root: C:/Dewaynewww/TrentonWeb/Apache2/htdocs
global doc root:

Anyone have any ideas why I can't using my include/required documents?

TIA for any help

May 17 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
At Thu, 17 May 2007 11:37:35 -0700, dp*****@gmail.com let his monkeys
type:
Greetings,
I have the following:

require_once($_SERVER["DOCUMENT_ROOT"]."/virtuals/doc-root.php4");

I also have several more include and include once that pull various
sections into my main page. I am trying to get this working on a local
machine for testing purposes. I have (windwos) Apache and PHP set up
on my machine and have written several test pages to confirm things
are working. When I perform an echo of the Document_root and
global_root I get the following:

server doc root: C:/Dewaynewww/TrentonWeb/Apache2/htdocs
global doc root:

Anyone have any ideas why I can't using my include/required documents?

TIA for any help
I'm not sure about / being valid on windoze. If not, use \\ instead
(easape the \), or use single quotes.
It might be a safe mode restriction, or an open_basedir setting keeping
you from succesfully including.

You should check what errors you get:

start your script with:
error_reporting (E_ALL);
ini_set("display_errors","1");
and see what errors are displayed.

HTH
Sh.
May 17 '07 #2

P: n/a
On May 17, 2:56 pm, Schraalhans Keukenmeester <inva...@invalid.spam>
wrote:
I'm not sure about / being valid on windoze. If not, use \\ instead
(easape the \), or use single quotes.
It might be a safe mode restriction, or an open_basedir setting keeping
you from succesfully including.

You should check what errors you get:

start your script with:
error_reporting (E_ALL);
ini_set("display_errors","1");
and see what errors are displayed.

HTH
Thanks. I tried adding in the error scripting, but I don't seem to see
any errors being generated on the page. I will try switching the
slash, but my newbie question is how would that effect it once I have
loaded to a server?

Thanks again
May 17 '07 #3

P: n/a
At Thu, 17 May 2007 12:03:59 -0700, dp*****@gmail.com let his monkeys
type:
On May 17, 2:56 pm, Schraalhans Keukenmeester <inva...@invalid.spam>
wrote:
>
I'm not sure about / being valid on windoze. If not, use \\ instead
(easape the \), or use single quotes.
It might be a safe mode restriction, or an open_basedir setting keeping
you from succesfully including.

You should check what errors you get:

start your script with:
error_reporting (E_ALL);
ini_set("display_errors","1");
and see what errors are displayed.

HTH

Thanks. I tried adding in the error scripting, but I don't seem to see
any errors being generated on the page. I will try switching the
slash, but my newbie question is how would that effect it once I have
loaded to a server?

Thanks again
As said, I'm not sure \ isn't allowed on Windows. You may wanna check the
php manual for that. But since you get no errors it seems fine.

If you upload it to a non-windows server you'd always have to use \ afaik.

But, not getting any errors at all with above additions? Hmm, that might
indicate the files are properly required/included after all.
Can you show a relevant snippet of your working code?
If you echo a string following the require, does that display properly?

Sh.
May 17 '07 #4

P: n/a
On May 17, 3:17 pm, Schraalhans Keukenmeester <inva...@invalid.spam>
wrote:
As said, I'm not sure \ isn't allowed on Windows. You may wanna check the
php manual for that. But since you get no errors it seems fine.

If you upload it to a non-windows server you'd always have to use \ afaik.

But, not getting any errors at all with above additions? Hmm, that might
indicate the files are properly required/included after all.
Can you show a relevant snippet of your working code?
If you echo a string following the require, does that display properly?

Sh
I tried the echo (you will see it in the code below) but it did not
display on the screen. I am really new to PHP, so there is a good
possibility I am doing something wrong...

<?
$updated = "4/3/07";
//$_SERVER["DOCUMENT_ROOT"] = str_replace( $_SERVER["PATH_INFO"],

//"", ereg_replace( "[\][\]", "/", $_SERVER["PATH_TRANSLATED"] )

//)."/";

require_once("virtuals/doc-root.php4");
echo "test";

?>
<html>
<head>
<?

include_once($_SERVER["DOCUMENT_ROOT"]."/virtuals/header-
script.php4");

?>

<?

include_once($_SERVER["DOCUMENT_ROOT"]."/virtuals/header-home.php4");

?>

I will check the docs to see if windows will support both slashes
May 17 '07 #5

P: n/a
dp*****@gmail.com wrote:
On May 17, 3:17 pm, Schraalhans Keukenmeester <inva...@invalid.spam>
wrote:
>As said, I'm not sure \ isn't allowed on Windows. You may wanna check the
php manual for that. But since you get no errors it seems fine.

If you upload it to a non-windows server you'd always have to use \ afaik.

But, not getting any errors at all with above additions? Hmm, that might
indicate the files are properly required/included after all.
Can you show a relevant snippet of your working code?
If you echo a string following the require, does that display properly?

Sh

I tried the echo (you will see it in the code below) but it did not
display on the screen. I am really new to PHP, so there is a good
possibility I am doing something wrong...

[skip]

I will check the docs to see if windows will support both slashes

Forward slash ( / ) works perfectly on WIndows systems and it is the one
you must use in your 'include' and 'require' statements.

If you're just starting with php, I'd suggest you get one of
pre-packaged windows installations (e.g.
http://www.apachefriends.org/en/xampp.html) and let it setup everything
for you.
--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
May 17 '07 #6

P: n/a
Schraalhans Keukenmeester wrote:
At Thu, 17 May 2007 11:37:35 -0700, dp*****@gmail.com let his monkeys
type:
>Greetings,
I have the following:

require_once($_SERVER["DOCUMENT_ROOT"]."/virtuals/doc-root.php4");

I also have several more include and include once that pull various
sections into my main page. I am trying to get this working on a local
machine for testing purposes. I have (windwos) Apache and PHP set up
on my machine and have written several test pages to confirm things
are working. When I perform an echo of the Document_root and
global_root I get the following:

server doc root: C:/Dewaynewww/TrentonWeb/Apache2/htdocs
global doc root:

Anyone have any ideas why I can't using my include/required documents?

TIA for any help

I'm not sure about / being valid on windoze. If not, use \\ instead
(easape the \), or use single quotes.
It might be a safe mode restriction, or an open_basedir setting keeping
you from succesfully including.

You should check what errors you get:

start your script with:
error_reporting (E_ALL);
ini_set("display_errors","1");
and see what errors are displayed.

HTH
Sh.
Schraalhans,

'/' is perfectly good in windows. Perhaps its' the spaces in your paths?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 18 '07 #7

P: n/a
"/" is working fine in windows. please send the code and before check
that there is any spaces in between /s

May 18 '07 #8

P: n/a
Schraalhans Keukenmeester wrote:
I'm not sure about / being valid on windoze. If not, use \\ instead
(easape the \), or use single quotes.
'/' has been a valid file separator since DOS 2.x IIRC. Certain DOS and
Windows *programs* don't recognise it, but the OS kernel itself does.

(Annoyingly COMMAND.COM is/was one of those programs that didn't recognise
it!)

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
May 18 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.