473,795 Members | 3,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Fwd: Problem with __FILE__ magic constant]

Does no one have any insight?......p lease?

Chris

-------- Original Message --------
Subject: Problem with __FILE__ magic constant
Date: Tue, 06 Jan 2004 16:43:41 GMT
From: Chris Pomasl <po**********@s tarband.net>
Organization: Starband Communications
Newsgroups: comp.lang.php

We picked up a helpdesk script from sourceforge, Mantis. This script
uses the __FILE__ magic constant to ostensibly derive the path to the
include directory from a script in the top level directory.

Reading the doc about __FILE__ did not gain me enough insight as to what
is going on.

My testbed is running PHP 4.1.0 but the server where it is to run is
4.0.6. The script specifically says that it is designed for a minimum
4.0.6.

In 4.1.0, the __FILE__ constant is set to the full path to the running
script starting from the root:
/home/mydirectory/public_html/mantis/script.php
In 4.0.6, the __FILE__ constant is set to only: /script.php

My question is regarding the history of __FILE__ between these releases
and whether there is any way to influence what is returned by __FILE__?
I could change the script for our purposes but before I even think of
that, I was wondering if there were PHP options that affect this behavior.

As far as upgrading the 4.0.6 to a higher release, I could ASK but the
server is not mine (or I'd likely be at the 4.3.x level.)

TIA,
Chris

--
Christopher J. Pomasl Starband 360, 004/68 Suse Linux 8.0 + KDE 3.1.2
Bari, Sound of the Rockies Chorus Lead, Gimmick quartet
Senior Software Engineer - DB2 products Computer Associates, inc
Always remember, you are unique.....just like everyone else!!
To email me, remove the spam stuff from my eddress

--
Christopher J. Pomasl Starband 360, 004/68 Suse Linux 8.0 + KDE 3.1.2
Bari, Sound of the Rockies Chorus Lead, Gimmick quartet
Senior Software Engineer - DB2 products Computer Associates, inc
Always remember, you are unique.....just like everyone else!!
To email me, remove the spam stuff from my eddress
Jul 17 '05 #1
1 2449
On Fri, 09 Jan 2004 19:52:19 GMT, Chris Pomasl <po**********@s tarband.net>
wrote:
Does no one have any insight?......p lease?

Chris

-------- Original Message --------
Subject: Problem with __FILE__ magic constant

http://bugs.php.net/search.php?cmd=d...h_for=__FILE__

... looks like a good place to start.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>
Jul 17 '05 #2

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

Similar topics

0
1851
by: Chris Pomasl | last post by:
We picked up a helpdesk script from sourceforge, Mantis. This script uses the __FILE__ magic constant to ostensibly derive the path to the include directory from a script in the top level directory. Reading the doc about __FILE__ did not gain me enough insight as to what is going on. My testbed is running PHP 4.1.0 but the server where it is to run is 4.0.6. The script specifically says that it is designed for a minimum 4.0.6.
6
8479
by: Tom | last post by:
I'm trying to dynamically adjust the path for one of my scripts using this: $script_path = str_replace( $_SERVER, "", dirname(realpath(__FILE__)) ) . DIRECTORY_SEPARATOR; The problem: the server I'm currently testing it on returns for $_SERVER something like the path "home/user/path/" and for __FILE__ "home2/user/path/scriptdir/" I tried to trace the discrepancy running phpinfo, but the only reference I can find to
9
25263
by: qazmlp | last post by:
How exactly __FILE__ and __LINE__ macros are defined? Or, Is the definition of these macros implementation dependent ? I am wondering how easily they can get the file name and line number respectively.
1
1780
by: Johan Lindh | last post by:
This is somewhat obscure, and I'm not sure if the question is valid in comp.lang.c. If it isn't, please ignore it. In a C program, the pointer resulting from a __FILE__ is stored. The pointer refers to a normal string constant (I think). Does the standard say anything about when that constant is destroyed, thus rendering any use of the stored pointer undefined behavior? I guess the question might be simplified into:
5
2706
by: baumann.Pan | last post by:
where are these macros defined? can I use it a release ver code?
19
5172
by: youpak2000 | last post by:
Are MAGIC numbers always bad? Using magic numbers (constant numbers) in programs are generally considered a bad programming practice, and it's recommended that to define constants in single, visible place in a header file. My question is that is there any situation where using magic numbers is not necessarily a bad thing? lets say that we want to initialize some private variables in a class using some constant default numbers, can we...
18
29424
by: Lukas Ruf | last post by:
Dear all, for debugging purposes, I like the pre-compiler macros __FILE__, __FUNCTION__, __LINE__ I have been wondering if there is a short form of __FILE__ that provides only the filename without path. I am using gcc as available in Debian unstable:
46
3692
by: lovecreatesbea... | last post by:
Do you prefer malloc or calloc? p = malloc(size); Which of the following two is right to get same storage same as the above call? p = calloc(1, size); p = calloc(size, 1);
4
3896
by: allan.mcrae | last post by:
As part of a very simple memory leak detector, I am trying to store the value of __FILE__ in a char*. Since gcc4.2 I get the following warning... warning: deprecated conversion from string constant to 'char*' object. The macro of delete assigns this to a global char* which is used to track where deletions were made. Something like: #define delete delete_FILE_ = __FILE__, \
0
9672
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
10437
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
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
10164
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
10001
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
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4113
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
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.