How do I identify the web server and PHP runtime on a Linux server?
Installed software and the process serving your website are not always the same. A control panel can run multiple web servers or PHP versions, and a reverse proxy may own the public port while another service handles the application. Start with the listener, then inspect the corresponding service.
Before you start
- Sudo access if process ownership is hidden from your account.
Instructions
1. Find the public listeners
Identify the process names attached to HTTP and HTTPS. These may be a web server, container proxy or load-balancer process.
sudo ss -lntp 'sport = :80 or sport = :443'Filters listening TCP sockets to the usual HTTP and HTTPS ports. Use the actual ports if your service differs.
2. List matching service units
Unit names vary. Ubuntu commonly uses apache2 and versioned PHP-FPM units, while RHEL-family installations commonly use httpd and php-fpm. Inspect the returned names instead of assuming a version.
systemctl list-units --all --type=service 'nginx*' 'apache2*' 'httpd*' '*fpm*' --no-pagerLists matching service units and their current states.
3. Check the relevant binaries
Run only the command for software that is present. The PHP command-line binary may have a different version and configuration from the FPM service used by the website.
nginx -vReports the Nginx binary version when Nginx is installed.
php -v
php --iniReports CLI PHP and its configuration paths; this does not establish the website’s FPM configuration.
Check the result
- You can trace the public listener to its service and identify the PHP handler actually configured for the website.
Troubleshooting
- The package is installed but its service is inactive
- The site may use another instance, container or control-panel service. Follow the listener and configured request path before starting anything new.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
