It does not fail to find the image (I believe) in fact, when an image is not found then a red cross appears.
In this case the red cross is not there as in the place it should be I can see a small white page in which inside there is a red round, a green triangle... It is an image that the OS uses in some cases...
Of course it has worked well from the files that are in the root directory:
How do you solve the fact that there are files that are not in the root folder?
In my case I have index.php as a file that is being used as a template from multiple languages... then it happesn that it is being called (included) from different folders. Once this happens... then problems start...
index.php is at the root folder and it can access without trouble the images that are inside the "images" folder.
but any of the files that is being used inside any of the other folders i.e. index.php (when it is included from another folder) then I would need to use "../images/file.png".
How could I get the root of the web page folder? and then use it in order to load images?
First of all I try and avoid such situations.
When I can't, require_once("../includes/somefile.php"); works for me. But then I'm not sure what would happen if somefile.php would contain another include or require.
While I would prefer ASP.Net, PHP has the advantage of being able to be hosted on Linux servers. This keeps running costs much lower than ASP.Net servers. Functionally they are pretty much the same, PHP has some funny syntax. ASP.Net has the advantage of being able to use C# as code behind, which would integrate better with desktop applications and WCF(web) services. The choice is ultimately just an arbitrary one, dependant on the developer.
Having recently moved a site from ASP to PHP I can tell you that ASP was 10x easier for me (but most of my exp until recently in programming has been VB, C#). I was able to get things working a lot faster in ASP and how I wanted them to. Off hand I can't really think of anything I have done in PHP that I thought, "God I'm sure glad I'm using PHP to do this, as it's so much easier".
The only up side is the use of a Linux server for PHP. I'm sure there are other pros and cons, but I work on a web site about 3 hours a month for a intranet site here at work and now just use PHP as I'm forced to (admin won't run IIS).
$path_root = $_SERVER['DOCUMENT_ROOT'].'/';
include($path_root.'aaa.php'); // this one works well
include($path_root.'bbb.php'); // this one gives me the error * (see below).
* Error: : "Warning: include(C:/Program Files/EasyPHP-184.108.40.206/wwwbbb.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-220.127.116.11\www\index.php on line 9
It seems to me that, for any unknown reason the last '/' is getting removed automatically after using it inside an include clause.