The obvious thing, however, novice developers often come together with this problem. Not everyone uses advanced build systems and deployment frontend, and therefore many good old approaches work like
<script src="/script.js"></script> <link href="/style.css" rel="stylesheet" type="text/css" />
<script src="/script.js?v=% %"></script> // <script src="/script.js"></script>
A common scheme: “I will do code.backup.zip at the root, deflate it, and delete it. I quickly, who there knows that there is such a file. " The problem is that almost all sites from time to time crawl bots that stupidly sort out obvious links like /update.sql , /backup.sql , /config.php.bk , etc. There are hundreds of options in their database. Therefore, such leaving the files “in a quick way” in the open access can easily go sideways. And leave them on an ongoing basis - so just come out.
If it is very hot - create files with absolutely random names. But it's better not to do that at all. Do not be elusive Joe.
The approach in which production and development is rotated on one server is also often encountered. Sometimes, with a special increase, even the connection keys to the database (which are also on the same server) coincide, and only the name of the databases differ. What is fraught with:
In large projects, where there is a separate shaman admin, docker (or vagrant), many servers, a balancer, etc. - this problem, of course, will not arise. He rolled the image of the environment - and drove. However, let's face it - there are many who still use the “updated file - uploaded via FTP” approach, and getting a project like this to a novice developer is just to spit. And then there are problems when locally everything worked, but on the prode it disappeared. Therefore, always verify the identity of environments. Sometimes a minor version of some software (like php 7.0 on the prod and 7.2 locally) can break everything.
Young (not in terms of age - but in terms of experience) developers often forget about logs, hoping that the framework or a web server will do this. This is so, but such logs will help catch only very gross errors, such as syntax errors or incorrect queries. Therefore, when developing complex functionality, always write to the logs everything you can, this will greatly facilitate life in the future. You don’t write a highload project like a Facebook competitor, where you have to worry about losing an extra millisecond to write to the log, right?
All novice developers know that all code needs to be stored in a version control system like GIT or SVN. But at the same time, they often forget about other things that should also be backed up:
This is generally a popular moment. Especially on shared-hosting. What is so bad: security problems (are you sure that tomorrow there will be no vulnerabilities in such a product?), Reliability issues (web server crashes — no way to reach the database), convenience problems (need to feed a big backup? It's a long time. Plus web server configs need to rule). Solution - use a direct connection to the database, preferably via an SSH tunnel, without leaving the port open directly.
By the way, it intersects with point number 2 - bots are looking for the first one to open phpMyAdmin (immediately after wp-admin.php)
This is the so-called soft-delete approach. You have a good system in which the user can download files, and can delete. Before deleting, you have three questions in the style of "And do you really want to delete the file?" You are sure that the user will not be able to delete anything accidentally. Believe - can. Therefore, if you have no competitor facebook, and you do not need to work with terabytes of files / messages - do not delete anything once again. Sooner or later it will come in handy.
Sometimes there are cases that are completely unsettling. You clearly see one thing - and the code says the opposite. You see at the output of 4 characters - and the code considers them as 9. The fault is the invisible characters. Especially critical when working with some PDF files or something like when everything looks good - the parser swears. Well, or colleagues joked and threw an invisible symbol in the code while you were away for a nice debag! There may also be similar problems with multibyte encodings.
The solution - yes it is not as such, you just need to know about the opportunity, and this will already save you a lot of time in this situation.
And finally, a little funny advice. Do not use for debug what you should not show to the client. Sometimes, well, I really want to zadabazhit code with something like
if(everythingIsBad()){ die('FUCK'); }
Source: https://habr.com/ru/post/359168/
All Articles