For versions of PHP < 5.5.0, you can get the name of the script from $argv[0]: http://www.php.net/manual/en/reserved.variables.argv.php
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
cli_get_process_title — 現在のプロセスのタイトルを返す
現在のプロセスのタイトルを返します。これは cli_set_process_title() で設定したものです。 これは、ps や top で表示されるタイトルと必ずしも一致するとは限りません。OS に依存します。
この関数は、 CLI モードでしか使えません。
この関数にはパラメータはありません。
例1 cli_get_process_title() の例
<?php
echo "Process title: " . cli_get_process_title() . "\n";
?>
For versions of PHP < 5.5.0, you can get the name of the script from $argv[0]: http://www.php.net/manual/en/reserved.variables.argv.php