.htaccess Strict-Transport-Security

Here are a few things we like to implement as a standard.


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
ErrorDocument 401 /401.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml
Options -Indexes
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set X-Content-Type-Options nosniff
Header set X-XSS-Protection "1; mode=block"
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>

The Zend OPcache

php scripts not updating?  FTP a new php file and it doesn’t update for the browser?

The issue could be the OPcache enabled on the server.

In my case I have changed the frequency that it checks for updated files.

Some good examples here:

https://www.scalingphpbook.com/blog/2014/02/14/best-zend-opcache-settings.html

https://tideways.com/profiler/blog/fine-tune-your-opcache-configuration-to-avoid-caching-suprises

How to Enable OPcache in cPanel

default value cannot be empty

Moving a site from one server to another that was php, java & mySQL I started to get an error that the default value cannot be empty.

This was a simple table and the offending column was a column for adding data to later as a message to the user.

The data type was LONGTEXT with a Default of None.

Not sure what was different between servers but I changed this to VARCHAR, 255 with the default value of NULL

I also had an error of: Data truncated for column ‘asap’ at row 1

This Column was an ENUM using no/yes. I changed the default to NULL instead of as defined.