telling unix and windows apart

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    #1

    telling unix and windows apart

    Hi everyone,
    I wonder is there a way in php for it to find out if the system is a windows
    or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
    but it does not seem to work.

    Thanks for your help.

    --
    AKA Marketing.com - Internet Marketing (mainly)
    .NET blog with close to 300 posts on .NET ecosystem topics such as .NET, C#, Entity Framework, SQL Server, Visual Studio and Azure as well as miscellaneous software development topics.

    .NET blog with close to 300 posts on .NET ecosystem topics such as .NET, C#, Entity Framework, SQL Server, Visual Studio and Azure as well as miscellaneous software development topics.

    t : 353 - 87- 9807628 ||| e: contactATakamar keting.com


  • J.O. Aho

    #2
    Re: telling unix and windows apart

    Dave wrote:[color=blue]
    > Hi everyone,
    > I wonder is there a way in php for it to find out if the system is a windows
    > or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
    > but it does not seem to work.[/color]

    You could use $_SERVER['DOCUMENT_ROOT'] to check if the path contians
    non-standard slashes '\', if it does, thne you have that stuiff from that
    strange company.


    //Aho

    Comment

    • Michael Fesser

      #3
      Re: telling unix and windows apart

      .oO(Dave)
      [color=blue]
      >I wonder is there a way in php for it to find out if the system is a windows
      >or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
      >but it does not seem to work.[/color]

      PHP_OS

      Micha

      Comment

      • Chris Hope

        #4
        Re: telling unix and windows apart

        Dave wrote:
        [color=blue]
        > I wonder is there a way in php for it to find out if the system is a
        > windows or unix based system. I read $_ENV[WINDIR] is set on windows
        > but not unix but it does not seem to work.[/color]

        Use the PHP_OS constant

        --
        Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

        Comment

        • Dave

          #5
          Re: telling unix and windows apart

          support is so quick here, thanks everyone I'm sure I can get one of these
          suggestions working, but for the PHP_OS was exactly do I do?

          is it like $os = PHP_OS();
          echo $os;

          Thanks again.

          --
          AKA Marketing.com - Internet Marketing (mainly)
          .NET blog with close to 300 posts on .NET ecosystem topics such as .NET, C#, Entity Framework, SQL Server, Visual Studio and Azure as well as miscellaneous software development topics.

          .NET blog with close to 300 posts on .NET ecosystem topics such as .NET, C#, Entity Framework, SQL Server, Visual Studio and Azure as well as miscellaneous software development topics.

          t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
          "Dave" <contact@akamar keting.com> wrote in message
          news:css1bd$dpj $1@kermit.esat. net...[color=blue]
          > Hi everyone,
          > I wonder is there a way in php for it to find out if the system is a[/color]
          windows[color=blue]
          > or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
          > but it does not seem to work.
          >
          > Thanks for your help.
          >
          > --
          > AKA Marketing.com - Internet Marketing (mainly)
          > http://www.akamarketing.com/hosting
          > http://www.akamarketing.com/webmaster-forums
          > t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
          >
          >[/color]


          Comment

          • Dave

            #6
            Re: telling unix and windows apart

            oh guys I actually got it working after doing a quicky on Google. Really
            useful. What other constants are avaible? and can anyone give me a URL to a
            list or resources for them.

            Cheers

            --
            AKA Marketing.com - Internet Marketing (mainly)
            .NET blog with close to 300 posts on .NET ecosystem topics such as .NET, C#, Entity Framework, SQL Server, Visual Studio and Azure as well as miscellaneous software development topics.

            .NET blog with close to 300 posts on .NET ecosystem topics such as .NET, C#, Entity Framework, SQL Server, Visual Studio and Azure as well as miscellaneous software development topics.

            t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
            "Dave" <contact@akamar keting.com> wrote in message
            news:css3ao$ec3 $1@kermit.esat. net...[color=blue]
            > support is so quick here, thanks everyone I'm sure I can get one of these
            > suggestions working, but for the PHP_OS was exactly do I do?
            >
            > is it like $os = PHP_OS();
            > echo $os;
            >
            > Thanks again.
            >
            > --
            > AKA Marketing.com - Internet Marketing (mainly)
            > http://www.akamarketing.com/hosting
            > http://www.akamarketing.com/webmaster-forums
            > t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
            > "Dave" <contact@akamar keting.com> wrote in message
            > news:css1bd$dpj $1@kermit.esat. net...[color=green]
            > > Hi everyone,
            > > I wonder is there a way in php for it to find out if the system is a[/color]
            > windows[color=green]
            > > or unix based system. I read $_ENV[WINDIR] is set on windows but not[/color][/color]
            unix[color=blue][color=green]
            > > but it does not seem to work.
            > >
            > > Thanks for your help.
            > >
            > > --
            > > AKA Marketing.com - Internet Marketing (mainly)
            > > http://www.akamarketing.com/hosting
            > > http://www.akamarketing.com/webmaster-forums
            > > t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Michael Fesser

              #7
              Re: telling unix and windows apart

              .oO(Dave)
              [color=blue]
              >oh guys I actually got it working after doing a quicky on Google. Really
              >useful. What other constants are avaible? and can anyone give me a URL to a
              >list or resources for them.[/color]

              It's all in the manual.

              Predefined Constants


              Magic constants


              Micha

              Comment

              • Good Man

                #8
                Re: telling unix and windows apart

                "Dave" <contact@akamar keting.com> wrote in
                news:css3ku$eh9 $1@kermit.esat. net:
                [color=blue]
                > oh guys I actually got it working after doing a quicky on Google.
                > Really useful. What other constants are avaible? and can anyone give
                > me a URL to a list or resources for them.
                >
                > Cheers[/color]

                just make a file like so, and observe the variables:

                <?php

                phpInfo();

                ?>

                Comment

                • Chris Hope

                  #9
                  Re: telling unix and windows apart

                  Good Man wrote:
                  [color=blue]
                  > "Dave" <contact@akamar keting.com> wrote in
                  > news:css3ku$eh9 $1@kermit.esat. net:
                  >[color=green]
                  >> oh guys I actually got it working after doing a quicky on Google.
                  >> Really useful. What other constants are avaible? and can anyone give
                  >> me a URL to a list or resources for them.
                  >>
                  >> Cheers[/color]
                  >
                  > just make a file like so, and observe the variables:
                  >
                  > <?php
                  >
                  > phpInfo();
                  >
                  > ?>[/color]

                  That gives you a lot of useful information but it doesn't give you the
                  constants.

                  Refer to

                  PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

                  PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


                  The unfortunate thing about these lists is they do not explain what the
                  constants are actually for. Most in reserved.consta nts.core.php are
                  self explanatory whereas reserved.consta nts.standard.ph p aren't so, but
                  are generally referenced in the relevant functions.

                  --
                  Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

                  Comment

                  • Martin Kissner

                    #10
                    Re: telling unix and windows apart

                    Dave wrote :[color=blue]
                    > Hi everyone,
                    > I wonder is there a way in php for it to find out if the system is a windows
                    > or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
                    > but it does not seem to work.[/color]

                    <?
                    phpinfo();
                    ?>

                    First line.

                    Martin

                    --
                    Epur Si Muove (Gallileo Gallilei)

                    Comment

                    • R. Rajesh Jeba Anbiah

                      #11
                      Re: telling unix and windows apart

                      Dave wrote:[color=blue]
                      > oh guys I actually got it working after doing a quicky on Google.[/color]
                      Really[color=blue]
                      > useful. What other constants are avaible?[/color]

                      Try get_defined_con stants()

                      --
                      <?php echo 'Just another PHP saint'; ?>
                      Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

                      Comment

                      Working...