473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Get Current Script File Name

How do you get the name of the currently execting script?

By this I mean the name of the include file that is being executed:

File: include.php
<?php
//Call some function to display include.php or whatever my filename is
?>

File: holder.php
<?php
inlcude( "include.php" );
?>

I tried everything in the $_SERVER variable but to no avail - Googling
it doesn't help as it all points to either the include method or the
$_SERVER variable. These all just give me 'holder.php' or similar.

I want this as I want to create a LOGGER class similar to the one in
Java to catch errors and keep them logged in a file I can download from
time to time.

Apr 26 '06 #1
4 13696
__FILE__

Apr 26 '06 #2
1. use __FILE__

2. You don't need to code a new Logger Class, PEAR Log package can suit
your needs.

Apr 26 '06 #3
leo

"thehuby" <th*****@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
How do you get the name of the currently execting script?

By this I mean the name of the include file that is being executed:

File: include.php
<?php
//Call some function to display include.php or whatever my filename is
?>

File: holder.php
<?php
inlcude( "include.php" );
?>

I tried everything in the $_SERVER variable but to no avail - Googling
it doesn't help as it all points to either the include method or the
$_SERVER variable. These all just give me 'holder.php' or similar.


what is the output of $_SERVER['PHP_SELF']?

what is your php version?
Apr 27 '06 #4
leo wrote:

"thehuby" <th*****@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
How do you get the name of the currently execting script?


what is the output of $_SERVER['PHP_SELF']?


Not what he is looking for.

1) it does not account for included files
2) Apache can be tricked into putting different values in here (try Google
for more info).

C.

Apr 27 '06 #5

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

Similar topics

6
by: vishal | last post by:
hi how can i get the file name from which the current executing file is called. i m making a scrript which will be called from many other scripts. this script performs some calculation and then...
6
by: David Van Mosselbeen | last post by:
Hi, Im a newbie in Python, and also in Fedora Core 3. (Yes, Linux is fine man :-) My question is : How can i rwite a script that show my current ip. If i have more than one network card, the...
5
by: - CT - | last post by:
Is it possible to use javascript to get a list of files from the current directory where the html page that contains the javascript is being called? The reason is that I want to find all ".jpg"...
3
by: Damian | last post by:
Hi everyone I'm having an issue with one of our applications. I'm getting the following error when attempting to log in to the site: Server Error in 'xxxxxxxxxxxxxxxx' Application....
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
2
by: Abraham Andres Luna | last post by:
hello everyone, does anyone know why i can't access the HttpContext.Current.User.Identity.Name property in a .cs file? this is the index.aspx page: <%@ Page Language="C#" %> <script...
3
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current...
1
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
1
vikas251074
by: vikas251074 | last post by:
Hello sir, I am facing some problem for which I am trying hard to solve it. But in vain. This programe is for View/Deletion. When I run program for first time, I select vlan from list and press...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.