Include Problem


I’m trying to make my own script with a built-in 404 error page

when i use the function Include like this example


the sever stops doing anything for about 30 seconds then it comes back to work

but when i use the function like


the script gets me the site normally

the problem is when i include a local file the server stops

and the “allow_url_include” is turned on

it was working well when i was installing windows XP but the problem showed when i installed Windows 7

I’m using Appserv the latest version on the site now

notice that i tried to upload a file into a free hosting server with Linux installed and it didn’t work either

so please help me cuz i’m going crazy :confused: and please don’t tell me search in the forums cuz i tried to but didn’t find any similar topic (:

Figure out what the current working directory is by temporarily including this in your code.

echo getcwd() . "

Then make your include relevant to that directory instead of using the http://localhost


thank you for replying but nothing happened it gives me this error

Warning: include(C:\\AppServ\\www\\myscript\\404.html) [function.include]: failed to open stream: Invalid argument in C:\\AppServ\\www\\myscript\	est.php on line 15

Warning: include() [function.include]: Failed opening 'C:\\AppServ\\www\\myscript\\404.html' for inclusion (include_path='.;C:\\php5\\pear') in C:\\AppServ\\www\\myscript\	est.php on line 15


It might be that your system is refusing the PHP application access to that file.

Have you tried relative addressing correctly? The error message indicates the files are in the same directory, so it would be… ( include(‘404.html’); )

well thank you all for your support
i’ve installed Xampp Server instead of Appserv and the script is working :slight_smile:
but on the free hosting file still the same problem guess the problem with the server maybe they’re not turning the “allow_url_include” Off
so thank you i really appreciate your support <3

Yes It’s is i’ve uploaded a file with the “phpinfo();” function in it and found

allow_url_fopen		Off
allow_url_include	Off

my final question :slight_smile: : is there any function that allows me to allow the url include in a specific page only or it must be configured from the server only ??

i’ve tried the ini_set function and it didn’t work :frowning:
anyway thank you guyz for your support :slight_smile:

why wont include(“/myscript/404.html”); work?

it was a problem with the Appserv Server that it wasn’t compatible with Windows 7
so i’ve installed Xampp Server and it’s working on both of the include methods
this one


and this one


that’s on the localhost server but on the free hosting server the problem was that the “allow_url_include” was switched off.

Shared hosting often features safe_mode = on which rules out allow_url_include amongst other things.