Recently to help with security, I had my web hosting company create a directory for me that's outside of the web document tree. There's a directory called 'Includes' that's located on the same level as the directory 'html'.

Anyway, in the 'Includes' directory, there is a sub-directory called 'Ads'. In this directory, there is a PHP file called 'banner_ads.php' and a bunch of JPG image files. In this php file, I run a simple command:

echo '<img src="/home/virtual/ofre.com/var/www/includes/Ads/ad1.jpg" border=0 />';

Anyways, when I call this file 'banner_ads.php' from a script that's in the web document tree like so:

include_once ('/home/virtual/ofre.com/var/www/includes/Ads/banner_ads.php');

This image does not get displayed. Is there an issue with the way PHP files are run when outside the web document tree? Am I having the command point to the wrong location/path? Thanks!

    img src="/home/virtual/ofre.com/var/www/includes/Ads/ad1.jpg"

    How is the outside web user supposed to be able to access "/home/..." when they aren't located on your server? They cant. The image source is going to have to be a directory they can see, i.e. http://ofre.com/includes/Ads/ad1.jpg

      duh! oh yeah. so basically, move the images to the web document tree, but i can leave 'banner_ads.php' in the "Includes" directory which is outside the web document tree, correct? cool. i'll try this out in the morning and mark it resolved if it works. thanks!

        dude. great call. that was the problem. thanks a bunch. that was seriously bothering me.

          Write a Reply...