how to validate that php is working in debian 8?

I have just installed debian on my computer to use it as a server and I have installed php, mysql and phpmyadmin but I do not know how to validate that if I install them well since the interface is by means of commands, so I would like to know what commands I can use to validate that I have

 1
Author: Juan Pinzón, 2016-10-26

2 answers

To check if php is installed you can check the version of it, for this you can use the linux terminal with the command:

php -v

This will return something like:

PHP 5.6.26-0+deb8u1 (cli) (built: Sep 21 2016 12:37:50) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

To check that apache is running with the necessary modules, for example the php5 module, you can use the command

apache2ctl -M

This command will return something like:

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 setenvif_module (shared)
 status_module (shared)

Alternatively to use these commands you can create an index file.php on your server (/var/www / html) and inside this place:

<?php
  echo phpinfo();
?>

With that you check the version of PHP and all the modules available for PHP in apache for example the module php5-mysqlnd that allows the connection between PHP and MySQL.

 3
Author: Juan Pinzón, 2016-10-27 15:55:01

In the console enter the following command:

 php -v

Should return the following message:

 Copyright (c) 1997-2014 The PHP Group
  Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
  with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

Greetings.

 2
Author: Alfredo Cortés Flores, 2016-10-26 17:21:34