how do I check against the PHP version?

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

    how do I check against the PHP version?

    I'm writing an installation script for my PHP content management
    system. I've written the code to be compatible with PHP 4.06 or later.
    I need to get the PHP version and throw an error message if the
    version is less than 4.0.6. I realize that phpinfo outputs the info,
    but what function would get me the version string?
  • Chris Hope

    #2
    Re: how do I check against the PHP version?

    lawrence wrote:
    [color=blue]
    > I'm writing an installation script for my PHP content management
    > system. I've written the code to be compatible with PHP 4.06 or later.
    > I need to get the PHP version and throw an error message if the
    > version is less than 4.0.6. I realize that phpinfo outputs the info,
    > but what function would get me the version string?[/color]

    There's a function called phpversion() and a constant called PHP_VERSION

    Refer to http://www.php.net/php_version for more information

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

    Comment

    • Kevin Lin

      #3
      Re: how do I check against the PHP version?

      Also see "version_compar e" which lets you test if a version is equal to or
      greater.

      - Kevin

      "lawrence" <lkrubner@geoci ties.com> wrote in message
      news:da7e68e8.0 411222137.6b6a0 c42@posting.goo gle.com...[color=blue]
      > I'm writing an installation script for my PHP content management
      > system. I've written the code to be compatible with PHP 4.06 or later.
      > I need to get the PHP version and throw an error message if the
      > version is less than 4.0.6. I realize that phpinfo outputs the info,
      > but what function would get me the version string?[/color]


      Comment

      • Alan Little

        #4
        Re: how do I check against the PHP version?

        Carved in mystic runes upon the very living rock, the last words of
        Kevin Lin of comp.lang.php make plain:
        [color=blue]
        > "lawrence" <lkrubner@geoci ties.com> wrote in message
        > news:da7e68e8.0 411222137.6b6a0 c42@posting.goo gle.com...[color=green]
        >> I'm writing an installation script for my PHP content management
        >> system. I've written the code to be compatible with PHP 4.06 or
        >> later. I need to get the PHP version and throw an error message if
        >> the version is less than 4.0.6. I realize that phpinfo outputs the
        >> info, but what function would get me the version string?[/color][/color]
        [color=blue]
        > Also see "version_compar e" which lets you test if a version is equal
        > to or greater.[/color]

        Of course, that's only good if the installation is 4.1.0 or greater :)
        There is a version check function in HoloLib:

        ftp://ftp.holotech.net/hololib.zip

        --
        Alan Little
        Phorm PHP Form Processor

        Comment

        Working...