Tuesday 19 September 2017

bash - Linux: Interpreted-on-read (ala php) for local files

So the specific problem is that I want a file on my system to link to a http url, but fallback to a local version if there's no connection. The catch is that the program reading this file will be expecting css and so won't, by default, execute any access/fallback script I put in the file.


This got me thinking more generally:
When you access a php file on a webserver, before you read the file contents, the php script is interpreted. As far as any program accessing the file is concerned, the contents are the output (I know this only works because you are accessing it over http).


Does anyone know of an equivalent for local files? I'm aware that I could just setup apache and use a local http request to get exactly this behaviour from php, but I was interested to know if it was possible without that.


I am running Ubuntu 16.04 in case that makes a diference

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...