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 7843497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:33:51+00:00 2026-06-02T16:33:51+00:00

I searched for quite a while now, but i could not find a definite

  • 0

I searched for quite a while now, but i could not find a definite answer to the question wether the constant PHP_OS contains the OS php was built on or runs on.

The php documentation of php_uname (http://php.net/manual/de/function.php-uname.php) states:
“For the name of just the operating system, consider using the PHP_OS constant, but keep in mind this constant will contain the operating system PHP was built on. “

However, on the very same page there is a comment from 2006 stating:
“Contrary to the last note, PHP_OS does display the OS PHP runs on currently, […] This has nothing to do with the system PHP was built on.”

I could not find any definite answer anywhere on the web regarding this question (topis about php_uname and PHP_OS mostly only cover os detection and similar topics). What’s right now – the documentation or the comment?

The pear-core package uses PHP_OS to determine wether it’s running on Unix-like systems or on windows, so is it safe to assume the documentation is indeed wrong?

  • 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-06-02T16:33:52+00:00Added an answer on June 2, 2026 at 4:33 pm

    I had a look at the source code. The configure script does this:

    PHP_OS=`uname | xargs`
    AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
    

    and then main.c does this:

    char *php_os;
    php_os=PHP_OS;
    REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
    

    which means that PHP_OS in PHP is what was in php_os in the C code, which is what was #defined by the header file constructed by the configure script, which is determined by running uname at configuration time.

    So, it’s the system you were built on, not the system you were running on.

    There’s some special-cased code for Windows: main.c sets php_os to "WINNT" if WIN32 is defined. But, again, this is at build time, not at run time, even if you manage to compile on Unix and run on Windows or vice versa.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched for quite a while trying to find an answer to this without
after searched for a while I still couldn't find any answer to my question,
I've searched around and couldn't quite find the answer to my question. What is
I have searched the net and searched the net only to not quite find
first post here, I come in peace :) I've searched but can't quite find
I searched internet and SO but could not get solution to this issue. I
I have searched the internet now for quite a while and found several bits
I've searched for an answer to this question and came across hide scrollbar while
Not a great title but I'm looking more for some guidance, have searched quite
I've searched quite a time for an answer to this question. Following Codesmell: @Entity

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.