I’m having a trouble deploying my website. I’ve been building it under Windows, with WAMP and now I’m deploying to Linux.
Code like this works on 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 in the production environment with the message:
Warning: require(/req1.php) [function.require]: failed to open stream:
No such file or directory in /home/clash/public_html/req.php on line 5Fatal error: require() [function.require]: Failed opening required
‘/req1.php’
(include_path=’/home/clash/public_html/:.:/usr/lib/php:/usr/local/lib/php’)
in /home/clash/public_html/req.php on line 5
The path in ini_set is the path of the actual location of the website on the server filesystem.
I wouldn’t like to avoid absolute paths as a library that I use relies on them somewhat.
I am sure that I’m missing something very simple here, but I can’t figure out what.
Thanks!
On Linux,
/is the root of the filesystem, similar toC:\on Windows. Remove the leading/and it will work as expected.