including files in project pages
Posted by: dantinux (151.80.5.---)
Date: February 13, 2008 10:38AM

Hi, I am a newby, so please bear with me (ex ASP programmer smiling smiley

I set up WAMP5 just fine, started a new project "romanord-info" which was already running on an ISP (on linux)

Now all my includes, (in the following case the file to be included is /romanord-info/includes/config.php) for which is invoked on page romanord-info/it/index.php,

<?php
include ($_SERVER['DOCUMENT_ROOT']."/includes/config.php"winking smiley;
?>

return these two errors:

Warning: include(C:/wamp/www/includes/config.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\romanord-info\it\index.php on line 2

and

Warning: include() [function.include]: Failed opening 'C:/wamp/www/includes/config.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\romanord-info\it\index.php on line 2

the first warning is telling me the romanord-info folder is being skipped for some reason, the second one tells me php is looking into an include path which i do not recognize.


QUESTIONS:
1. I cannot find this .;C\php5\pear directory as the include_path anywhere in the php.ini file, but it shows up in phpinfo(), what is going on?
2. Since I would like to have different projects in C:\wamp\www and would like to be able for each to use includes which resolve to their own root folder (in this case \romanord-info) what do I set the include_path to?
3. If for semplicity's and speet's sake I give up on having multiple projects in my wamp\www directory, how do I make the include path also recognize the romanord-info folder as part of the DOCUMENT_ROOT?

Thank you in advance!

Options: ReplyQuote
Re: including files in project pages
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: February 13, 2008 12:37PM

wamp does not come with pear installed


Warning: include(C:/wamp/www/includes/config.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\romanord-info\it\index.php on line 2


this warning is not saying what you thought. it says (C:/wamp/www/includes/config.php) does not exist . which it doesnt,


Warning: include() [function.include]: Failed opening 'C:/wamp/www/includes/config.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\romanord-info\it\index.php on line 2

again pear is not installed in wamp so of course it cant find C:\php5\pear

Options: ReplyQuote
Re: including files in project pages
Posted by: toivo (---.nsw.bigpond.net.au)
Date: February 13, 2008 12:39PM

Hi,

It looks like the DocumentRoot directive in the Apache configuration file httpd.conf or the virtual host configuration file is set to C:/wamp/www instead of C:\wamp\www\romanord-info. The DocumentRoot should point to the root folder of the site.

Yes, you can manage several independent sites by setting each one of them up as a virtual host, with its own DocumentRoot. Then your $_SERVER variable will also pick up the DocumentRoot where the script is running.

You would not need to change the include path at all if you use $_SERVER['DOCUMENT_ROOT'] as a prefix to the path and if your virtual hosts are configured correctly. Each project can then have their own include folder.

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: including files in project pages
Posted by: yfastud (Moderator)
Date: February 13, 2008 01:41PM

Check Setup Virtual Host on my personal websites to get the ideas

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.