Viewed   121 times

I have an Apache virtual host that looks like this:

<VirtualHost *:80>
    DocumentRoot /srv/web/

I have the following file:


I am requesting the following URL (notice that I am using the ServerAlias, not the ServerName:

I'd like to have test.php output the ServerName variable somehow ( Is there any way to do that?



Apparently, when you access a VirtualHost through the alias, there is no trace of the original SERVER_NAME in any of the $_SERVER variables.

The only idea that comes to mind is setting an environment variable:


this should set the value of $_SERVER["MY_HOST"] to the correct host name. No guarantees though, I have never tried this in practice.

Friday, November 4, 2022

Try to use xfilesend module for Apache.

Saturday, November 12, 2022

If you use a newer version of PostgreSQL (> 8.1) you should use the RETURNING clause of INSERT (and UPDATE) command.

OTOH if you insist on using one of the sequence manipulation functions, please read the fine manual. A pointer: "Notice that because this is returning a session-local value, it gives a predictable answer whether or not other sessions have executed nextval since the current session did."

Thursday, November 10, 2022

This is a VHost I took from my httpd-vhosts.conf. The only extra configuration I made was to get around the 403 I was hitting:

<VirtualHost *:80>
    ServerName "Markdown.loc"
    ServerAlias "www.Markdown.loc"
    DocumentRoot "C:INTERNALPHPMarkdown"
    <Directory "C:INTERNALPHPMarkdown">
        Options +Indexes
        AllowOverride All

All my other VHosts look like this:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/somesite.loc"
    ServerName somesite.loc
    ServerAlias www.somesite.loc

If you're simply looking to include something from a dir on the same level as your htdocs though, include("../includes/somefile.php") should work just fine.

If I've got your problem wrong, let me know, and I'll try to help you more.

Sunday, September 4, 2022

It will be quite easy, once you can pull down a timeline and display it, to then add some file-based-caching to it.

check age of cache
Is it more than 5 mins old?
    fetch the latest information
    regenerate the HTML for output
    save the finished HTML to disk
display the cached pre-prepared HTML

PEAR's Cache_Lite will do all you need on the caching layer.

Sunday, July 31, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :