The issues which I have had with the PHP for the last ten years is the community, tutorials and/or guides, and the development of web applications. Yet at the same time, the core of PHP is the amazing people which I have met so far with talent – they have created some of the best, unique web applications to date.
For the other majority percentage of the community, they tend to usually be all beginners and people who seem to know what they are doing. They tend to focus more on writing tutorials, articles, and posts that are designed to help people learn the language. From my experiences so far, these people do not know what they are talking about.
Why is W3Schools still around?
W3Schools is a good website. There is no doubts about it. Yet they really need to update their content and enforce good programming standards for their tutorials and guides. They still allow their tutorials to use
mysql_ functions as if that is the right thing to do in 2022, let alone throughout the 2010s.
Just having this site as the top search result on the major search engines is an issue in itself when you are looking for learning PHP and or referencing the official manual. I rather see more accurate, up to date information as a top search results than information that is over five... no wait... two years old.
This drives me insane when I am teaching someone PHP and they link the reference code and documentation from W3Schools instead of the PHP manual proves that people do not know what they are doing. Besides for that site, people are offering bad advice and deprecated coding techniques and ideas. People are still going to be using the MySQL functions in their tutorials and articles.
Database Access and Tutorials
I understand at one time that the MySQL functions were used in coding in PHP. They are not recommended at all. They have also need replaced by PDO and MySQLI which gives:
- Prepared statements
- Encryption with SSL
- Works with MSSQL, PostgreSQL, SQLite, etc.
What are we seeing in search results?
Deprecated tutorials that are totally and morally wrong to even see in the top results of a search engine. I am still seeing tutorials which are over ten years old for PHP database connections.
Sadly, we are not seeing properly designed tutorials to explain why to use PDO, how to connect to it with spaghetti code or class design. We see half-done tutorials to say throw this and this together for a database connection and to query information from the database. Even then, most of the time it does not even work in an actual test environment.
I am going to also call the majority of this issue is half-assed. They do not even mention error handling or throwing exceptions correctly. Even then, they are explaining how to do it in a development environment over a production environment. Giving out database details is morally wrong and leads to having your code exploitable and hackable.
Where are all of the good tutorials to explain database handling with handling errors and throwing exceptions correctly? If we had these, then the security of PHP would increase ten fold and allow developers to not be afraid of their code is exploitable; which it wouldn't be if it was done right the first time around and explained well.
Building a framework, MVC, or CMS with PHP
There are a few, actually good articles on how to design one of the three around on the web if you are willing to look for them. Maybe I am not looking hard enough for these type of tutorials and articles for designing these items.
The bare-bone basics is not good enough to fully understand what one is getting themselves into when they are starting a project like this or learning how these are designed. There is way more to it than just throwing a few classes together, calling functions here and there, and building a blogging platform.
When building a production based (also known as a live site) web application, you have to consider the three most important things when it comes to serving people on the web.
- Security Minded: One needs to make sure that their code is the most secure possible and exploitation free. Validate input, trust nobody, and try to be one step ahead of a person who wants to exploit websites.
- Performance Driven: Code needs to operate fast and load extremely fast. I try to keep all queries for loading information from a database in web application at 10 queries or under. The better the code performs, the better off the web application is going to be.C
- Web Design: I am horrible at this, but I stick to with what I know. I tend to use Bootstrap for my web design with a few colour changes and mobile-ready. This web design framework is a win-win for everyone from a mobile phone user to the desktop.
How to solve these issues?
The community is large enough to make a site dedicated to spreading accurate information tutorials and updating them like a wiki with better information and input in how to connect to a database, query information, designing a framework, and so much more.
When I teach people PHP, I try to give the most accurate, up to date information possible for them to design their simple content management systems, forum, or blogging software securely, driven with performance, and visually pleasing.