PHP + MySQL conventions on top of database-design-basics: prepared statements, utf8mb4, InnoDB, and PHP's shared-nothing request lifecycle.
0 downloads · Used by 0 stacks
Link back to this module from your own README.
[](https://markdowners.com/m/markdowners/php-mysql-conventions)No discussions about this module yet.
Start a discussionProject-level conventions for a PHP + MySQL codebase, applying Database Design Basics@markdowners/database-design-basics's rules within MySQL's specific defaults and PHP's request lifecycle.
utf8mb4 (not utf8, which in MySQL is a 3-byte-max legacy alias that cannot store full Unicode, including emoji and many CJK characters) — set it on the connection itself, not just the schema, or client-side mangling can still occur.InnoDB for every table (the default in modern MySQL, but verify) — it's the only mainstream engine with real foreign key enforcement, row-level locking, and transaction support; legacy non-transactional engines should not be used for new tables.DATETIME with an explicit application-level UTC convention, or TIMESTAMP only within its valid range and DST-handling caveats — be deliberate about which one and document the choice, since MySQL's two time types behave differently around timezones.utf8mb4-compatible case-insensitive collation consistently for text comparison and sorting — an inconsistent collation across tables/columns causes join and comparison behavior that's inconsistent in confusing ways.display_errors = Off in any production php.ini — a raw PHP error/warning rendered directly into an HTTP response can leak file paths, query fragments, or stack traces to any visitor. Log errors server-side instead, per general error-handling practice.
Comments (0)
Sign in to comment. Sign in
No comments yet. Be the first to add one.