How to check the presence of php and apache on ubuntu server through ssh

To check if PHP is installed on your Ubuntu system, you can use the following command:

php -v

This will display the version of PHP that is installed on the system. If PHP is not installed, the command will not return any output.

Watch a course Learn object oriented PHP

To check if Apache is installed on your Ubuntu system, you can use the following command:

apache2 -v

This will display the version of Apache that is installed on the system. If Apache is not installed, the command will not return any output.

You can also use the following command to check if Apache is running on your system:

systemctl status apache2

This will show the status of the Apache service and indicate whether it is running or not. If the service is running, it will also show the PID (process ID) of the Apache process.

Note that these commands should be run on the command line via an SSH connection to the Ubuntu server.