SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using PHP to echo current versions of Perl and MySQL

    I have a php page on which I want to echo the current versions of php, Perl and MySQL. The one for php is easy enough, but I'm not sure how to do the others.

    I'd appreciate any feedback on this.

    Thanks!

  2. #2
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [url=http://us2.php.net/manual/en/function.mysql-get-client-info.php]mysql_get_client_info()[/url for MySQL. For Perl, you could exec('perl -v') and parse it out of that - I'm sure there's a commandline switch that gives you just the version, but I don't know it unfortunately
    TuitionFree a free library for the self-taught
    Anode Says... Blogging For Your Pleasure

  3. #3
    SitePoint Addict Viral's Avatar
    Join Date
    Nov 2001
    Location
    Washington DC
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To get mysql version, use mysql_get_server_info() (http://us4.php.net/manual/en/functio...erver-info.php)

    To get perl, I would recommend something like :
    system('/path/to/perl -v');

    --Viral
    A computer without Windows is like a chocolate cake without mustard.

  4. #4
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you both for your quick replies. I got the MySQL version showing correctly now, unfortunately, it's the Perl version I'm struggling with.

    /usr/bin/perl -v gives me the version, but way more info than I need and (ugh...) I'm not sure how to parse it out....

  5. #5
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this might be the easiest Perl command to get the Perl version by itself:

    perl -e 'printf "%vd", $^V'

    I took a little look and I didn't see command line switch that accomplished the same thing. Not an exhaustive search, though, I could have missed it.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  6. #6
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by samsm
    I think this might be the easiest Perl command to get the Perl version by itself:

    perl -e 'printf "%vd", $^V'

    I took a little look and I didn't see command line switch that accomplished the same thing. Not an exhaustive search, though, I could have missed it.
    I did too and "perl -V:version" was the closest I got (prints "version='5.6.0';"), but your way is cleaner.
    TuitionFree a free library for the self-taught
    Anode Says... Blogging For Your Pleasure

  7. #7
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to everyone who replied! samsm -- it worked ideally!

  8. #8
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just one more for you all. How about deriving the current version of Apache from the command line?

  9. #9
    SitePoint Addict Viral's Avatar
    Join Date
    Nov 2001
    Location
    Washington DC
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe you can get that from PHP using this:
    $_SERVER["SERVER_SOFTWARE"]

    --Viral
    A computer without Windows is like a chocolate cake without mustard.


Bookmarks

Posting Permissions

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