Jump to content

Recommended Posts

HI guys, i really need to figure this out

 

im on a windows server, and somehow, when i use

 

include('../functions.php');

 

it doesn't find the functions.php page!!

 

i have a file name posting.php, it's in a folder, and i need to include the functions file to it.. i also tried

 

include('http://www.mu-anime.com/functions.php');

 

but it doesn't work...  Some people told me to try the code below since im on a windows server

 

include('C:\hshome\tipa-mu\mu-anime.com\functions.php')

 

but i got these warning messages

 

Warning: main(C:\hshome\tipa-mu\mu-anime.com\functions.php) [function.main]: failed to open stream: No such file or directory in C:\hshome\tipa-mu\mu-anime.com\shoutbox\posting.php on line 4

 

Warning: main() [function.include]: Failed opening 'C:\hshome\tipa-mu\mu-anime.com\functions.php' for inclusion (include_path='.;c:\php4\pear') in C:\hshome\tipa-mu\mu-anime.com\shoutbox\posting.php on line 4

 

What should i do? :(

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/
Share on other sites

I work with an IIS server. When I use an include or require_once, I put in the directory path from the main folder along with the file I need like this:

 

include ('./includes/header.html');

 

require_once('./includes/mysql_connect.php'); //connect to the db

 

Hope this helps.

 

~Robert

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-368473
Share on other sites

The ".." means go back one directory. Is the file located in the same directory as your source or one level up from your source. if it's in the same directory, you should use either:

<?php
include('./functions.php');
?>

or

<?php
include('functions.php');
?>

 

Ken

 

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-368576
Share on other sites

well,

 

the functions.php page resides where the index.php is..

 

I have a folder name Shoutbox and inside the folder there is a page name posting.php. Now, inside the posting.php, i need to include the functions.php, which is in the root directory!

 

even if i use include "../functions.php";

 

it doesn't include the file correctly... This is quite bizzare !!

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-369215
Share on other sites

Nopes it doesn't work .. and i wonder if there is a solution for this

 

also the code you gave me, it's basically this

 

C:\hshome\tipa-mu\mu-anime.com\shoutbox\functions.php, but it should not look for the functions.php page in the shoutbox folder.. the link should be like this

 

C:\hshome\tipa-mu\mu-anime.com\functions.php ..

 

See what i mean?

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-369226
Share on other sites

lets try something new

2 files, upload into same folder and run test1.php

<?php
echo "Hello ";
include "test2.php";
?>

<?php
echo "World";
?>

 

if that works (and it should)

 

create a folder called "TEST" and move test2.php into it, and change test1.php to

<?php
echo "Hello ";
include "TEST/test2.php";
?>

try that..

 

thats should also work.. NOW

create a new file called "test3.php" in the same place as "test1.php"

<?php
echo "Woohoo";
?>

 

and update test2 to

<?php
echo "World";
include "../test3.php";
?>

 

Lets see what happens

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-369248
Share on other sites

when i go to page test2.php, instead of showing

 

World Woohoo, i get this

 

World

Warning: main(../test3.php) [function.main]: failed to open stream: No such file or directory in C:\hshome\tipa-mu\mu-anime.com\test\test2.php on line 3

 

Warning: main() [function.include]: Failed opening '../test3.php' for inclusion (include_path='.;c:\php4\pear') in C:\hshome\tipa-mu\mu-anime.com\test\test2.php on line 3

 

And btw, my PHP include path is .;c:\php4\pear ! what does that mean??

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-369255
Share on other sites

this is the code i added in test1.php

 

<?php
echo "Hello ";
include "test/test2.php";
echo $_SERVER['DOCUMENT_ROOT'];
?>

 

i get this

 

Hello World

Warning: main(.. est3.php) [function.main]: failed to open stream: No such file or directory in C:\hshome\tipa-mu\mu-anime.com\test\test2.php on line 3

 

Warning: main() [function.include]: Failed opening '.. est3.php' for inclusion (include_path='.;c:\php4\pear') in C:\hshome\tipa-mu\mu-anime.com\test\test2.php on line 3

Link to comment
https://forums.phpfreaks.com/topic/73049-php-on-windows-server/#findComment-369267
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.