Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Include Function Driving Me Nuts
Old 01-09-2008, 03:40 PM Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
I have been trying to figure this out for hours but I can't see what the problem is:

PHP Code:

Warning
:  include() [function.include]: URL file-access is disabled in the server configuration in D:\AppServ\www\Symbian-Made-Simple\index.php on line 2

Warning
:  include(http://localhost/symbian-made-simple/includes/head.php) [function.include]: failed to open stream: no suitable wrapper could be found in D:\AppServ\www\Symbian-Made-Simple\index.php on line 2

Warning:  include() [function.include]: Failed opening 'http://localhost/symbian-made-simple/includes/head.php' for inclusion (include_path='.;C:\php5\pear'in D:\AppServ\www\Symbian-Made-Simple\index.php on line 2

Warning
:  include() [function.include]: URL file-access is disabled in the server configuration in D:\AppServ\www\Symbian-Made-Simple\index.php on line 3

Warning
:  include(http://localhost/symbian-made-simple//includes/body.php) [function.include]: failed to open stream: no suitable wrapper could be found in D:\AppServ\www\Symbian-Made-Simple\index.php on line 3

Warning:  include() [function.include]: Failed opening 'http://localhost/symbian-made-simple//includes/body.php' for inclusion (include_path='.;C:\php5\pear'in D:\AppServ\www\Symbian-Made-Simple\index.php on line 3 
</b>

What is the problem, here is my include code
PHP Code:
<?php 
include("http://localhost/symbian-made-simple/includes/head.php"); 
include(
"http://localhost/symbian-made-simple/includes/body.php"); 
$Content="Testing....";
$subTitle=" :: Latesta News"
?>
Even when I leave it to only includes/head.php It works but does not actually output any of the data contained in the head.php file.


Thanks in advance
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
 
Register now for full access!
Old 01-09-2008, 03:44 PM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
Forgot to mention, the only for the files to work is to put them in the
root directory.
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-09-2008, 05:08 PM Re: Include Function Driving Me Nuts
Defies a Status

Posts: 1,606
Trades: 0
Assuming all your information is correct, change this:
Quote:
include("http://localhost/symbian-made-simple/includes/body.php");
to:
include("includes/body.php");

This will load the file body.php from the directory includes. Includes must be a directory under the current working directory where the file is called.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 01-09-2008, 07:54 PM Re: Include Function Driving Me Nuts
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
As cobylt said.

PHP can do include over http, but this function has to be specifically enabled to be working.

As much as possible, try to always use local file includes rather than http includes.
First: you know where the file is, and it's harder to hijack a file on the server than to forge the request path to another path.
Second: an http include is slower than a local file due to the network connection latency. On low to middle activity sites, it won't be noticed, but if your traffic goes up, it can slow down your site.

And just for the sack of it, try to make the include via absolute paths, using $_SERVER['DOCUMENT_ROOT'] as reference.
PHP Code:
include("includes/body.php"); 
might be valid in 1 place of your site, but not every, as it looks for an include directory from the current place
PHP Code:
include($_SERVER['DOCUMENT_ROOT']."/includes/body.php"); 
This specify that the included file is located in the includes directory from the root of your site, and it will work from any subdirectories.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-10-2008, 01:59 AM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
I tried this way but still got an error
PHP Code:
include($_SERVER['DOCUMENT_ROOT']."/includes/body.php"); 
PHP Code:
Warning:  include(D:/AppServ/www/includes/body.php) [function.include]: failed to open streamNo such file or directory in D:\AppServ\www\Symbian-Made-Simple\index.php on line 2

Warning
:  include() [function.include]: Failed opening 'D:/AppServ/www/includes/body.php' for inclusion (include_path='.;C:\php5\pear'in D:\AppServ\www\Symbian-Made-Simple\index.php on line 2 
And when I tried this way the index page did not output anything, only a blank page. Here is my index.php code

Code:
<?php 
include("includes/body.php");   
$Content="Welcome to Symbian-Made-Simple";
$subTitle=":: Main Page"; 
?>


And my body code:
Code:
<body>
<?PHP 
echo "$Content";
?>
</body>
</html>
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-10-2008, 02:04 AM Re: Include Function Driving Me Nuts
Experienced Talker

Posts: 32
Trades: 0
PHP Code:
include(dirname(__FILE__)."/symbian-made-simple/includes/body.php"); 
This works for my includes and requires on my web server.
__________________

Please login or register to view this content. Registration is FREE
- Free Online Website Directory - NO Backlinks!

Last edited by ecuffo; 01-10-2008 at 02:06 AM..
ecuffo is offline
Reply With Quote
View Public Profile Visit ecuffo's homepage!
 
Old 01-10-2008, 02:19 AM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
nope, I'm still getting empty page
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-10-2008, 02:26 AM Re: Include Function Driving Me Nuts
Experienced Talker

Posts: 32
Trades: 0
Try taking out the symbian-made-simple/
__________________

Please login or register to view this content. Registration is FREE
- Free Online Website Directory - NO Backlinks!
ecuffo is offline
Reply With Quote
View Public Profile Visit ecuffo's homepage!
 
Old 01-10-2008, 02:40 AM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
Tried that but it still giving me an empty page
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-10-2008, 03:00 AM Re: Include Function Driving Me Nuts
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Can you open your body.php page wiith this line.

PHP Code:
 <?php echo $_SERVER['SCRIPT_FILENAME'?>
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 01-10-2008, 03:09 AM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
i don't understand what you mean by "open body.php with this line" ??
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-10-2008, 03:20 AM Re: Include Function Driving Me Nuts
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Open the body.php script in your editor , paste the line above at the top of script and then open the script body.php in your browser.

Edited to add - paste path thats returned

Last edited by maxxximus; 01-10-2008 at 04:14 AM..
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 01-10-2008, 03:47 AM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
it gives me the location of the script
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-10-2008, 06:12 AM Re: Include Function Driving Me Nuts
Rajaie's Avatar
Super Talker

Posts: 128
Trades: 0
never mind, it seems to suddenly started working
thanx for the help guys
Rajaie is offline
Reply With Quote
View Public Profile Visit Rajaie's homepage!
 
Old 01-21-2008, 09:14 PM Re: Include Function Driving Me Nuts
carloncho's Avatar
Skilled Talker

Posts: 80
Name: Carlos
Trades: 0
The error is that using an url in an include function. You must give this function, a path to the file.
__________________
-----------------------

Please login or register to view this content. Registration is FREE
carloncho is offline
Reply With Quote
View Public Profile Visit carloncho's homepage!
 
Reply     « Reply to Include Function Driving Me Nuts
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.08970 seconds with 12 queries