473,657 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting value of servername in <VirtualHost>

Hi,

I'm using PHP 4.4.4 with Apache 2. How would I get the value of the
"ServerName " attribute of the "<VirtualHostdi rective in the Apache
configuration (httpd.conf) file?

I noticed that "$_SERVER['SERVER_NAME']" is not the answer to this
question because we have multiple domains pointing to the same IP, and
"echo $_SERVER['SERVER_NAME']" always yields a value typed in the
browser's address bar.

Thanks, - Dave

Jul 27 '07 #1
3 2480
On Jul 27, 4:07 pm, "laredotorn...@ zipmail.com"
<laredotorn...@ zipmail.comwrot e:
Hi,

I'm using PHP 4.4.4 with Apache 2. How would I get the value of the
"ServerName " attribute of the "<VirtualHostdi rective in the Apache
configuration (httpd.conf) file?

I noticed that "$_SERVER['SERVER_NAME']" is not the answer to this
question because we have multiple domains pointing to the same IP, and
"echo $_SERVER['SERVER_NAME']" always yields a value typed in the
browser's address bar.

Thanks, - Dave
Hi, the $_SERVER['SERVER_NAME'] should do it...it should return
whatever is in your ServerName field, I thought... You could always
try making a test script with print_r($_SERVE R); which will just print
all of the values in the $_SERVER array, then just look through to see
if one of the keys contains the info being sought. Sorry I am not
very much help here.

Jul 27 '07 #2
On Jul 27, 4:15 pm, davidkru...@tec hie.com wrote:
On Jul 27, 4:07 pm, "laredotorn...@ zipmail.com"

<laredotorn...@ zipmail.comwrot e:
Hi,
I'm using PHP 4.4.4 with Apache 2. How would I get the value of the
"ServerName " attribute of the "<VirtualHostdi rective in the Apache
configuration (httpd.conf) file?
I noticed that "$_SERVER['SERVER_NAME']" is not the answer to this
question because we have multiple domains pointing to the same IP, and
"echo $_SERVER['SERVER_NAME']" always yields a value typed in the
browser's address bar.
Thanks, - Dave

Hi, the $_SERVER['SERVER_NAME'] should do it...it should return
whatever is in your ServerName field, I thought... You could always
try making a test script with print_r($_SERVE R); which will just print
all of the values in the $_SERVER array, then just look through to see
if one of the keys contains the info being sought. Sorry I am not
very much help here.
Good thought, but both $_SERVER['SERVER_NAME'] and
$_SERVER['HTTP_HOST'] contained what was in the browser's address
field, which was different than what was in my <VirtualHost>
ServerName.

Thanks though, - Dave

Jul 27 '07 #3
la***********@z ipmail.com wrote:
I'm using PHP 4.4.4 with Apache 2. How would I get the value of the
"ServerName " attribute of the "<VirtualHostdi rective in the Apache
configuration (httpd.conf) file?
Are you able to edit the httpd.conf file? If so, look at the
UseCanonicalNam e directive.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 37 days, 1:58.]

Cryptography Challenge
http://tobyinkster.co.uk/blog/2007/0...pto-challenge/
Jul 27 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2841
by: VK | last post by:
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from Tkinter import * class GetVariant: def __init__(self): self.root = Tk()
15
2956
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
6
2244
by: melanieab | last post by:
Hi, Easy question. It seems to me that I'm following the examples correctly, but apparently I'm not. I'm trying to retrieve the data from a row called "row" and a column called "File". This is what I have: (xFile is the int value in column File and tCat is the table) First I try: xFile = int.Parse((tCat.Rows).ToString()); Another example I found:
5
2290
by: velu | last post by:
Problem in getting value from textbox & radiobuttonlist to a valuable inside a datagid. I want to insert a record into a table thru datagrid. Here is the code (see below) Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.ItemCommand
2
4116
by: Kevin Walzer | last post by:
I'm trying to construct a simple Tkinter GUI and I'm having trouble with getting the value of an entry widget and passing it onto a callback function. But I'm not grokking variable scope correctly. I have two functions. Here are the relevant excerpts: def makeGUI(): ###lots of code to set up toplevel windows
3
2118
by: daveyand | last post by:
hey, I know in the new browsers you're not able to change the value of the status bar. Which is fair enough, i understand why and agree. Although, i cant seem to get the value of the status bar. One used to be able to do window.status. But that doesnt seem to work. Wondered if someone could point me in the right direction.
4
4571
by: bushi | last post by:
hi ! i have following code to display some text on a web form,after getting it from database. <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <asp:LinkButton ID="links" runat="server" Text='<%# Eval("links") %>' OnClick="LinkButton1_Click"></asp:LinkButton><br />
3
1568
by: koneru9999 | last post by:
i have one storedprocedure in database.from that i can get last login time .i fetched that value and assigned that value to session in one servlet class.from that session i am getting that last login time value and displaying in a jsp page. the value is displaying.upto this is ok. but if i want to format that date and time why i am not able to do that. when i am doing format with SimpleDateFormat()..it is giving error. what i have to do?...
1
1240
by: renatois | last post by:
Getting value from GridView Hi guys, I have a GridView and I need to access a value of an ID field on an event. I converted this field into template and the name of the label control in ItemTemplate is Label1. I´m doing string fabID = Convert.ToString(GridView1.FindControl("Label1")); When I hard-code it works (ex: string fabID = "22";) Can anyone pls help? any idea
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8603
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.