I am trying to get the filename of the script that is running (But not the include it is calling).
echo basename(__FILE__); # will always output include.php
echo basename($_SERVER['SCRIPT_FILENAME']);
# This will do what I want (echo myscript.php), but I was wondering if there was
# a better way to grab it, as I have had problems with $_SERVER['SCRIPT_FILENAME']
# when running certain scripts from a cron.
Any suggestions?
<?
#myscript.php
require('include.php');
echo "Hello all";
?>
<?
#include.php
echo basename(__FILE__);
echo basename($_SERVER['SCRIPT_FILENAME']);
?>
Thanks!