I am getting a trouble implementing this site. I have been building it under Home windows, with WAMP and today I am implementing to Linux.

Code such as this creates Home windows:

req.php

echo "This is req<br>";
ini_set("include_path", "/home/clash/public_html/:".get_include_path());
require "/req1.php";

req1.php

echo "This is req1";

But fails within the production atmosphere using the message:

Warning: require(/req1.php) [function.require]: unsuccessful to spread out stream: No such file or directory in /home/clash/public_html/req.php online 5

Fatal error: require() [function.require]: Unsuccessful opening needed '/req1.php' (include_path='/home/clash/public_html/:.:/usr/lib/php:/usr/local/lib/php') in /home/clash/public_html/req.php online 5

The road in ini_set may be the path from the actual location from the website around the server filesystem.

I would not prefer to avoid absolute pathways like a library which i use depends on them somewhat.

I am certain that I am missing something quite simple here, however i can't evaluate which.

Thanks!

On Linux, / may be the cause of the filesystem, much like C:\ on Home windows. Take away the leading / and it'll act as expected.

You are able to replace hard-coded path separator using the PATH_SEPARATOR constant. This way you make sure that your value for include_path is mix-platform.