Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1042609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:32:07+00:00 2026-05-16T15:32:07+00:00

On Linux $_SERVER[_] contains path to PHP interpreter executable (for example /usr/bin/php -r ‘echo

  • 0

On Linux $_SERVER["_"] contains path to PHP interpreter executable (for example /usr/bin/php -r 'echo $_SERVER["_"];' will print /usr/bin/php). On Windows XP with PHP 5.3 $_SERVER["_"] is NULL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:32:08+00:00Added an answer on May 16, 2026 at 3:32 pm

    That’s nothing to do with PHP itself. It’s shell that defines that environment variable. PHP just picks it up

    For instance, see here:

    The shell sets up some default shell variables; PS2 is one of them. Other useful shell variables that are set or used in the Korn shell are:

    • _ (underscore) — When an external command is executed by the shell, this is set in the environment of the new process to the path of the executed command. In interactive use, this parameter is also set in the parent shell to the last word of the previous command.
    • …

    I think your best shot in Windows is to write an internal function. E.g.

    PHP_FUNCTION(get_php_path)
    {
        char path[MAX_PATH];
        int result;
    
        if (zend_parse_parameters_none() == FAILURE)
            return;
        
        result = GetModuleFileNameA(NULL, path, MAX_PATH);
    
        if (result == 0)
            RETURN_FALSE;
    
        if (result == MAX_PATH) {
            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Path is too large");
            RETURN_FALSE;
        }
    
        RETURN_STRINGL(path, result, 1);
    }
    

    Example:

    >php -r "echo get_php_path()";
    D:\Users\Cataphract\Documents\php-trunk\Debug_TS\php.exe
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently had a linux server compromised from bots uploading .php scripts and
Im using PHP 5.3 on a linux server and I m trying to query
I'm doing IPC on Linux using boost::interprocess::shared_memory_object as per the reference (anonymous mutex example).
my current setup is as follows: We have a Linux samba share that contains
I have a folder which contains a ~50 text files (PHP) and hundreds of
I am reviewing a Linux based perl web application that contains a login handler
I have a PHP script (running on a Linux server) that ouputs the names
I have a linux server has an ad-hoc wireless network for clients to connect
I have a linux server, I am looking to convert a .wma file to
I'm using a linux server that display directories in a bold font, and files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.