When someone asks me to look after their website, the first thing I check is not the design. I look at how easy it would be for a stranger to get into the admin, read the database or upload a file they shouldn't. Most small business sites I take over are not "hacked". They are simply missing a short list of basics that stop the common attacks.
I build most client sites in PHP and MySQL, so this is the checklist I never skip. None of it needs an expensive security product. It is habits you apply while you build, and check again before launch. If you run WordPress, the same ideas apply through updates, plugins and hosting settings.
Short answer: the PHP security basics I never skip are HTTPS, a PHP version that still gets patches, prepared statements, hashed passwords, secrets kept off the public web, CSRF protection, tight upload rules and backups you can restore.
Use HTTPS everywhere
Every page should load over HTTPS, including the contact form, login and admin. A free Let's Encrypt certificate on the host is enough for almost every small business site I work on. I also force HTTP to redirect to HTTPS once the certificate is stable.
If the padlock in the address bar is missing, or the browser warns about mixed content, I fix that before I call the site finished. Login forms over plain HTTP are an open invitation to steal passwords.
Keep PHP on a supported version
Out-of-date PHP is one of the easiest ways a shared host gets compromised. I aim for a current PHP 8 release that the host still patches. Before switching versions I click-test forms, admin login, uploads and cron jobs on a staging copy.
On WordPress, the same rule covers core, the theme and every plugin. An abandoned plugin with one open hole is enough. If a plugin has not been updated in a long time, I switch to a maintained alternative before launch.
Prepared statements and escaped output
I never build SQL by sticking user input into a string. I use PDO with prepared statements and bound parameters for every query that touches visitor or admin data. That stops the classic SQL injection tricks where someone puts code into a search box or form field.
Anything that came from a user, a form or the database gets escaped when it is shown in HTML, usually with htmlspecialchars. This blocks cross-site scripting. Places people forget include admin lists of enquiries, page titles from the database, and error messages that echo the original input.
Hash passwords and keep secrets private
I store passwords with PHP's password_hash and check them with password_verify. I never store plain text, and I do not invent my own hashing. Admin accounts get long unique passwords, and I turn on two-factor login when the host supports it.
Database passwords, SMTP credentials and API keys sit outside the web root. I also keep backup zips and old site copies out of public folders. I have seen live sites where anyone could download a database dump by guessing a URL. That is covered in my note on backups for every client site.
CSRF on forms and a locked-down admin
Every form that changes something gets a CSRF token. The server creates a random token in the session, puts it in a hidden field, and rejects the post if the token is missing or wrong. On custom admin panels I treat this as required, the same way I treat hashed passwords. I wrote about that setup in building a simple admin panel for clients.
Admin login also gets rate limits and logging of failed attempts. After a handful of wrong passwords from the same IP, I slow or block further tries. Default users go, old contractor accounts get deleted, and on WordPress I keep the number of admins as small as possible.
File uploads and hidden errors
If the site lets anyone upload a file, I restrict allowed types by checking the real contents, not only the extension. Uploads go into a folder that cannot run PHP, with a random filename. Size limits and blocking double extensions like photo.php.jpg are part of the same habit. Contact forms that accept attachments get the same treatment, along with the spam controls I use so enquiries still land in the inbox.
On the live site, PHP errors never print to the browser. They go to a private log. A detailed error page can leak file paths and query fragments. I also turn off directory listing.
Backups are part of security
Security is not only about stopping attacks. It is also about recovering when something still goes wrong: a bad update, a compromised plugin, or a suspended hosting account. I set up automatic off-site backups of files and the database, and I test a restore now and then. Before any big change or host move I take a fresh manual copy, the same way I do when moving a site without downtime.
WordPress needs the same habits
On WordPress the checklist looks different on the surface, but the habits are the same: current PHP, current core and plugins, strong admin passwords, limited login attempts, uploads that cannot run PHP, secrets and backups kept safe, and HTTPS everywhere. I remove unused themes and plugins instead of leaving them installed "just in case".
A security plugin can help with scanning and login limits, but it is not a substitute for updates and sensible hosting. I would rather have a clean, updated site on a host that patches servers than a neglected site with five security plugins fighting each other.
What I tell small business owners
You do not need to become a security engineer. You do need someone who applies these basics when the site is built, and who keeps PHP, plugins and backups current afterwards. If your site was built years ago and nobody has touched the hosting panel since, it is worth a review before something breaks in public.
You can see how I build and maintain sites in my portfolio. If you want a plain checklist run on your own PHP or WordPress site, you can ask me about a security and maintenance review and I will tell you what I find in clear language.
On 18 November 2026, the official supported versions list on php.net showed PHP 8.2 receiving security fixes only until 31 December 2026, PHP 8.4 still in active support until that same date, and PHP 8.3 and 8.5 supported after that. I treat anything already past its security end date, or about to lose it, as urgent. A free Let's Encrypt certificate, turned on at the host with HTTPS forced, is enough for almost every small business site I work on. The certificate is not the whole job: mixed content, a stale PHP version and an open file upload will still get a site into trouble.
What "supported PHP" means right now
These dates come from the official supported versions list on php.net, checked on 18 November 2026:
- PHP 8.2 receives security fixes only until 31 December 2026. After that it is end of life.
- PHP 8.3 has security support until 31 December 2027.
- PHP 8.4 is in active support until 31 December 2026, then security support until 31 December 2028.
- PHP 8.5 is in active support until 31 December 2027, then security support until 31 December 2029.
If your host is still on 8.1 or older, or will still be on 8.2 in early 2027, that is a planned upgrade, not a nice-to-have. Pair that with HTTPS, prepared statements, hashed passwords and a backup you can restore, and you already have most of the basics I look for. If you want me to review a PHP site against this list, you can get in touch here.
If you want help with this on your own site, send me a message here or see what I've built.
Back to Blogs