The pick for shared hosting and traditional websites of pages and forms.
PHP has a reputation problem that mostly comes from code written fifteen years ago. Modern PHP is typed, fast and well tooled, and it still has one advantage nothing else matches: it runs on virtually every web host in the world with no setup at all.
PHP is the backend result in two situations:
Shared hosting decides it on its own because it's a hard constraint: PHP and MySQL are pre-installed, while Node.js and Python apps are supported only on some plans, and usually awkwardly.
PHP's model is the simplest on the web: a request comes in, a PHP file runs from top to bottom, and its output becomes the page. There's no long-running server process to manage, no port to configure and no build step - you upload a file and visit its URL.
That model is ideal for sites made of pages and forms: contact forms, booking requests, member areas, small CMSs. And when you outgrow plain PHP, Laravel is one of the most pleasant full-stack frameworks in any language, with authentication, queues, mail and an ORM built in. WordPress, which runs on PHP, also keeps a large freelance market alive - a practical consideration if you want paid work.
password_hash(), password_verify() and sessions, so you can delete spam entries.header.php and footer.php includes.PHP isn't just for web pages. Shared hosts let you schedule cron jobs from the control panel, and those can run PHP scripts on the command line: nightly clean-ups, sending reminder emails, fetching data from an API and caching it. If you picked "scripts or automation" on shared hosting, this is how you'd do it without changing hosts.
Shared hosting is one of the cheapest ways to run a dynamic site and usually includes a free SSL certificate, email accounts and a MySQL database. In the control panel, choose the newest PHP version your host offers (8.3 or later at the time of writing) - older versions stop getting security fixes.
mysql_query(), close the tab - those functions were removed in PHP 7. Use PDO with prepared statements.htmlspecialchars() before echoing it, or you've built a cross-site scripting hole.md5() or sha1() for passwords. Use password_hash(); it's built in and does the right thing.public_html, and display_errors left on in production - both leak information to anyone who looks.