How to check my PHP and MySQL version on Ubuntu VPS?

HI I am going to install MyBB but I am not sure whether I have installed the correct version of PHP and MySQL.

PHP version 5.1.0 or above with XML Extension installed

MySQL version 4.0 or above

How to check that? Especiall the PHP XML Extension?

Is there simpler way than the <?php phpinfo() ?> solution? I am expecting a command line solution.

Thanks a lot!


Solution 1:

Do it from your command line:

php -v
mysql -V

and:

php -i | grep -i '^libxml'

OR

Put this in your root directory:

 <?php
    phpinfo();
 php?>

Save it as phpinfo.php and point your browser to it (this could be http://localhost/phpinfo.php)

Solution 2:

Use dpkg to find the installed package versions.

dpkg -l | grep '\(php\|mysql\)'