1

I have a page called index.php which includes a page new_display.php which again includes two pages i.e. say x.php and y.php

The include is working fine on localhost but not on my hosting! The error i am getting is :-

Warning: require(/interests/sketching/udis.php) [function.require]: failed to open stream: No such file or directory in /hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php on line 154

Fatal error: require() [function.require]: Failed opening required '/interests/sketching/udis.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php') in /hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php on line 154

The Directories are :

index.php -> localhost/mysql

new_display.php -> localhost/mysql/interests/sketching/new_display.php ( Included in index.php as /interests/sketching/new_display.php )

then in new_display x.php and y.php are included as

/interests/sketching/x.php

/interests/sketching/y.php

It works all good in localhost but gives error when i publish the pages on the Domain

Does anyone has any idea why isn't this working?

2 Answers 2

4

/ indicates an absolute path, meaning your script is looking in the root of the filesystem for a directory called interests.

Instead, try just removing that / at the start of your paths, or prepend $_SERVER['DOCUMENT_ROOT'] to them.

Sign up to request clarification or add additional context in comments.

2 Comments

can you give me a small example of what $_server['DOCUMENT_ROOT'] works like and how can i use it? please @kolink
Use echo $_SERVER['DOCUMENT_ROOT'] to see what's in the variable. That should explain it for you.
0

You have to make

require(interests/sketching/udis.php)

Without

"/"

Because you have to point to the same folder ;).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.