Apache:

#httpd –v

If Ubuntu try:
#apache2 -v

MySQL:

On a server running Plesk:

#mysql -uadmin -p`cat /etc/psa/.psa.shadow`
>SELECT version();

On a server running WHM/cPanel:

#mysql
SELECT version();

PHP:

#php –v

Perl:

#perl -v

Python:

#python -v