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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:26:03+00:00 2026-05-12T14:26:03+00:00

For building a unix/dos specific script I need to know on which kind of

  • 0

For building a unix/dos specific script I need to know on which kind of operating system I am.

How do i get this information?
phpinfo(); tells me a lot more and not very clear whether I’m running on unix or not.

  • 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-12T14:26:03+00:00Added an answer on May 12, 2026 at 2:26 pm

    PHP has many predefined constants that are often useful.

    Here, PHP_OS is the one you are looking for.

    For instance, on my current machine, this code :

    var_dump(PHP_OS);
    

    Gives :

    string 'Linux' (length=5)
    

    You have some examples and comparisons with what the php_uname function can get you on the manual page of php_uname ; for instance (quoting) :

    <?php
    echo php_uname();
    echo PHP_OS;
    
    /* Some possible outputs:
    Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686
    Linux
    
    FreeBSD localhost 3.2-RELEASE #15: Mon Dec 17 08:46:02 GMT 2001
    FreeBSD
    
    Windows NT XN1 5.1 build 2600
    WINNT
    */
    
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        echo 'This is a server using Windows!';
    } else {
        echo 'This is a server not using Windows!';
    }
    

    That page also says :

    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.

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

Sidebar

Related Questions

I guess this question is directed at Linux/Unix system programming experts (unfortunately I am
I'm building a system where multiple slave processes are communicating via unix domain sockets,
we're building a scheduler system and have a couple of situations where we're trying
We are an all Unix shop (Solaris, Linux). This last product cycle I returned
When building PHP applications I always end up having trouble trying to get everything
I need to do some quick-and-dirty Perl GUI building. I can't afford a Komodo
I'm currently PHP building a script that has to update statistics when it finishes
Building a comment system with Ajax and JQuery and I want the div the
I'm building a node.js application and storing a six-digit base36 representation of a unix
I am in the process of building interactive front-ends to a distributed application which

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.