Apache Get Version

Discussion in 'PHP' started by proprod, Dec 12, 2006.

  1. #1
    Hello all...

    This is not working for me to show my apache version:

    <?php
    $version = apache_get_version();
    echo "$version\n";
    ?>
    Code (markup):
    From what I read on the php.net website, if failure, it returns a false. I'm assuming for some reason I'm getting a false. Is there any way around this that anyone knows of? When I do a phpinfo.php, the apache version shows fine.

    Any help would be appreciated, thanks!!!
     
    proprod, Dec 12, 2006 IP
  2. Krownet

    Krownet Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Run this and let me know what it says:

    
    <?php
    
    if (function_exists('apache_get_version')) {
    	if (!$version = apache_get_version()) {
    		die('Failed');
    	} else {
    		echo "$version\n";
    	}
    } else {
    	die('Function does not exist');
    }
    ?>
    
    PHP:
     
    Krownet, Dec 12, 2006 IP
  3. proprod

    proprod Active Member

    Messages:
    216
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Ahhh... it says function does not exist.
     
    proprod, Dec 12, 2006 IP
  4. Krownet

    Krownet Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sounds like PHP is not running as an Apache module.

    http://www.php.net/manual/en/ref.apache.php

    Cheers,
     
    Krownet, Dec 12, 2006 IP
  5. proprod

    proprod Active Member

    Messages:
    216
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Gotcha, thanks alot for the replies :)
     
    proprod, Dec 12, 2006 IP
  6. proprod

    proprod Active Member

    Messages:
    216
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    90
    #6
    ...and actually, thanks to the URL you provided me, I was able to find what would work:

    <?php
    
    echo "" . $_SERVER['SERVER_SOFTWARE']
    
    ?>
    Code (markup):

    Thanks again!
     
    proprod, Dec 12, 2006 IP
  7. Krownet

    Krownet Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7

    Good to hear it :) I should have read that page myself :p

    Good luck and happy coding!

    Cheers,
     
    Krownet, Dec 12, 2006 IP