I recently read some forum comments about using PHP for server-side scripting. The people directed their comments toward someone just beginning to learn PHP. They were telling that person that he or she should learn something else, like Python, instead of PHP.
Why not PHP? It’s been around for years, longer than I can remember. It’s a mature programming language. I think some people hate it, but I really can’t understand why.
I wouldn’t recommend PHP as a client-side scripting language. Sure, you can use it that way (and I do) but using it for server-side scripting is where it works the best.
I’m well aware of other server-side scripting languages, like ASP, Python and Node.js. For simple, regular websites on non-Windows servers, I think PHP is the best language to use. The online manual is easy to follow.
PHP is dead simple to use. You can embed it or you can include it, although including means embedding at least one line. There are template engines available if you’d rather not mix HTML and PHP.
Just because it’s available doesn’t mean you have to use it for everything. Many content management systems like WordPress use PHP, but it’s unnecessary for static websites. Well, mostly.
There are some aspects to every website that need one type of scripting or another. Even if it’s something as simple as “server-side includes” (SSI) handled by the web server itself, you need something to process forms with. That is, unless you don’t use any forms at all.
My website is static. The only thing I use PHP for is to process the contact form.