Display Apache version in PHP?

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Display Apache version in PHP?

    Hello All

    I am just asking if it is possible to get the apache version installed on
    the server in PHP.

    If this is possible can somebody tell me what function or code is I have to
    use to do this.

    Thanks in advance.

    Paul Kirby


    Paul Kirby Guest

  2. Similar Questions and Discussions

    1. #40728 [NEW]: configure won't identify apache version
      From: sheezes at gmail dot com Operating system: AIX 5.3 PHP version: 5.2.1 PHP Bug Type: *Compile Issues Bug description: ...
    2. Apache Version With ColdFusion
      Hi , I am new to Cold Fusion. Can one of you please let me know the support matrix for Apache and ColdFusion. I wanted to know what version of...
    3. ColdFusion MX 7 Apache Axis Version
      Does anyone know what version of Apache Axis ColdFusion MX 7 is using? Jeff
    4. #21220 [Opn->Csd]: Wrong Apache version in phpinfo() shown
      ID: 21220 Updated by: sniper@php.net Reported By: psychosos at gmx dot at -Status: Open +Status: ...
    5. Apache::MP3 fails to display playlists
      Red Hat Linux 7.0 Apache 1.3.12 mod_perl 1.28 Apache::MP3 3.04 Apache::MP3::Playlist is failing to display playlists when I connect to the web...
  3. #2

    Default Re: Display Apache version in PHP?

    It depends of your Apache configuration (ServerTokens)
    You might find it in $_SERVER["SERVER_SIGNATURE"]
    HTH
    j.
    johannes m.r. Guest

  4. #3

    Default Re: Display Apache version in PHP?


    "johannes m.r." <psychosos@gmx.at> wrote in message
    news:3pqemvo7r0kek728lpisvna5kp3s9lv3cv@4ax.com...
    > It depends of your Apache configuration (ServerTokens)
    > You might find it in $_SERVER["SERVER_SIGNATURE"]
    > HTH
    > j.
    Thanks for replying.

    That returns the version but also the modules as well.

    I just want the version.

    Like it displays in phpinfo()

    Thanks in advance
    Paul Kirby


    Paul Kirby Guest

  5. #4

    Default Re: Display Apache version in PHP?

    $_SERVER['SERVER_SOFTWARE']

    should contain something like this:

    Apache/2.0.40 (Red Hat Linux)

    SO:
    $ar = split("[/ ]",$_SERVER['SERVER_SOFTWARE']);
    $apache_version = $ar[1];

    HTH

    "Paul Kirby" <admin@initcorp.co.uk> wrote in message
    news:bk7h4l$fhe$1$8302bc10@news.demon.co.uk...
    > Hello All
    >
    > I am just asking if it is possible to get the apache version installed on
    > the server in PHP.
    >
    > If this is possible can somebody tell me what function or code is I have
    to
    > use to do this.
    >
    > Thanks in advance.
    >
    > Paul Kirby
    >
    >

    sam Guest

  6. #5

    Default Re: Display Apache version in PHP?


    "sam" <rbaba99@caramail.com> wrote in message
    news:bk7tk1$1irn$1@news.cybercity.dk...
    > $_SERVER['SERVER_SOFTWARE']
    >
    > should contain something like this:
    >
    > Apache/2.0.40 (Red Hat Linux)
    >
    > SO:
    > $ar = split("[/ ]",$_SERVER['SERVER_SOFTWARE']);
    > $apache_version = $ar[1];
    >
    > HTH
    >
    Thanks that worked a treat :)

    I ended up using the following:
    $ar = split("[/ ]",$_SERVER['SERVER_SOFTWARE']);
    for ($i=0;$i<(count($ar));$i++)
    {
    switch(strtoupper($ar[$i]))
    {
    case 'APACHE':
    $i++;
    $Apache_Version = $ar[$i];
    break;
    case 'PHP':
    $i++;
    $PHP_Version = $ar[$i];
    break;
    case 'MOD_SSL':
    $i++;
    $MOD_SSL_Version = $ar[$i];
    break;
    case 'OPENSSL':
    $i++;
    $OPENSSL_Version = $ar[$i];
    break;
    }
    }

    Echo "Apache Version: $Apache_Version<br>\n";
    Echo "PHP Version: $PHP_Version<br>\n";
    Echo "mod_ssl Version: $MOD_SSL_Version<br>\n";
    Echo "OpenSSL Version: $OPENSSL_Version<br>\n";

    That way all I have to do is add another case if I want to add another
    version variable :)

    Thanks
    Paul Kirby


    Paul Kirby Guest

  7. #6

    Default Re: Display Apache version in PHP?

    >I just want the version.
    >
    >Like it displays in phpinfo()
    If you think about the string returned in the "Apache version" row
    under "apache" - it's not that Apache Version, but the version of
    Apache php4apache.dll was compiled with.
    (see [url]http://bugs.php.net/bug.php?id=21220[/url])
    For example, I use Apache 1.3.28 right now but phpinfo() displays
    1.3.24
    Just FYI :)
    j.
    johannes m.r. Guest

  8. #7

    Cool Re: Display Apache version in PHP?

    function versaoServer(){

    $version = explode("/", $_SERVER['SERVER_SOFTWARE']);

    $softNum = explode(" ", $version[1]);

    $soft = $version[0].'/'.$softNum[0];

    echo $soft;

    }
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139