Hello,
in order to use my scripts developed at home directly after upload, I
wish to define a variable $root at begin of each script in a way that
it always - be it here at home or on any other computer - contains the
correct path to the web docs directory. How shall I do that the best
way? (At least, how do I get the local IP or hostname? Or is there an
environment variable?) Grepped 4 thick books but nothing found...
TIA, Daniel 5 4894
On Sun, 05 Jun 2005 16:51:56 GMT, Daniel Loose wrote: correct path to the web docs directory.
$_SERVER['DOCUMENT_ROOT'] but maybe that's Apache specific, dunno.
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Daniel Loose wrote: Hello,
in order to use my scripts developed at home directly after upload, I wish to define a variable $root at begin of each script in a way that it always - be it here at home or on any other computer - contains the correct path to the web docs directory. How shall I do that the best way? (At least, how do I get the local IP or hostname? Or is there an environment variable?) Grepped 4 thick books but nothing found...
TIA, Daniel
If I understand you right, .... what I do is look at the SERVER variable
HTTP_HOST.
if ($_SERVER['HTTP_HOST'] == 'localhost')
{
// the script is running on my home computer and not on the remote server
}
else
{
// $_SERVER['HTTP_HOST'] contains the domain name where my script is running
}
--
*************** **************
Chuck Anderson • Boulder, CO http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*************** **************
$_SERVER['SERVER_NAME'] will return the name of the server. This will be
either 'LOCALHOST' or something different.
You should not need this anyway as $_SERVER['DOCUMENT_ROOT'] will contain
the right information. This works for me as I develop on Windows and upload
the same scripts to a Linux box.
--
Tony Marston http://www.tonymarston.net
"Daniel Loose" <no*****@web.de > wrote in message
news:42******** *******@news.cs .tu-berlin.de... Hello,
in order to use my scripts developed at home directly after upload, I wish to define a variable $root at begin of each script in a way that it always - be it here at home or on any other computer - contains the correct path to the web docs directory. How shall I do that the best way? (At least, how do I get the local IP or hostname? Or is there an environment variable?) Grepped 4 thick books but nothing found...
TIA, Daniel
i use a config file for these cases, because usually not only pathes
differ between your dev box at home and the actually server (database
pswd do often, for instance).
i require that file at the top of each script and keep two different
config files.
micha
"Daniel Loose" wrote: Hello,
in order to use my scripts developed at home directly after upload, I wish to define a variable $root at begin of each script in a way that it always - be it here at home or on any other computer - contains the correct path to the web docs directory. How shall I do that the best way? (At least, how do I get the local IP or hostname? Or is there an environment variable?) Grepped 4 thick books but nothing found...
TIA, Daniel
I use php in web and batch mode, and some of the $_SERVER variables
don’t work in batch mode. I use getcwd http://ca3.php.net/manual/en/function.getcwd.php to look at the path,
and from that detect where the app is running.
--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-detect-l...ict229718.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=796276 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Tarantino |
last post by:
Hello,
I am trying to find a way to create a scheduled task or
service that will copy my local profile folders
under "Documents and settings" to a network drive. This
would allow me to restore my settings if my profile became
tampered with or corrupt. Is there any sample code
available out there?
-Robert
|
by: Niki Kovacs |
last post by:
Hi,
I'm an Austrian writer living in Montpezat (South France). I just installed
a local W3C validator on my machine (Slackware 10.1, local Apache server).
It's accessible as http://w3c-validator, because I'm on dialup and I want
to check pages offline.
Unfortunately, URL upload won't work, because the validator doesn't accept
any URL's...
|
by: Morten |
last post by:
How do I detect if a client socket is no longer connected to the listen tcp
socket ?
I have tried with (just an example):
---------------------
Socket tcpSocket;
while(tcpSocket.Connected)
|
by: hb |
last post by:
Hi,
Would you please tell me how to detect if the client's browser is closed?
I need such event to trigger a database modification.
Thank you
hb
|
by: ton |
last post by:
How can I detect that the user has modified the data on the page where
several textboxes, checkboxes and dropdownlist exist.
Ton
| |
by: Brad |
last post by:
I have a win2003 server workstation with multiple webs, each web has it's
own ip address. In VS2005, if I select to open an existing web site, select
Local IIS, the dialog correctly displays a list of all of my webs, however
if I attempt to open a site under and web other than localhost I receive the
message:
"Unable to open the Web...
|
by: Jay |
last post by:
Hi, Everybody:
I have a script host that implemented in Java and using FESI to run
JavaScript. The JavaScript files are separated into different files and
putting together at run or load time. Every time I have to manually to
make sure that a function referenced in one file is defined in another
so my host won't crash due to exception. I...
|
by: Hooyoo |
last post by:
Hi, here,
How to get local machine name and IP address?
Thanks.
|
by: =?Utf-8?B?SmVycnkgQw==?= |
last post by:
I have a app that uses several membership/role providers. I can list these
Providers with the code:
Dim rootWebConfig1 As Configuration
rootWebConfig1 =
WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)
Dim section As New MembershipSection
section = rootWebConfig1.GetSection("system.web/membership")
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |