I have 7 different custom websites, all on the same server, that use the same config and image files. I would like to reference those files by "including" using PHP, or referencing them as src images. Unfortunately, when I try to pull the resources, I get errors. Is there a way to use these files directly from the /home/ directory so that a single change there is seen on all websites? Here is what I am using now that isn't working:
<?php include("/home/config.php"); ?>
and
<img style="vertical-align:bottom" src="/home/buy_button.png" border="0" />
This are two questions at once.
1 . How can I make PHP include these files. ?
Make sure the webserver user e.g. www-data on ubuntu has proper permissions to access those files. I would suggest something different from /home/.. (if you ask me)
2 . How to access those image files from web?
If you are using apache you'll have to create an alias that makes that images accesible via the web server.
Here comes an example for apache2
Place this configuration snippet in the proper place of your apache installation e.g. end of httpd.conf or a separate file. Don't forget to restart your webserver.
Now you should be able to access the images like: