To generate an SSL private key for use with MySQL/MariaDB and PDO:
openssl genrsa -out client-key.pem 4096
To generate an SSL private key for use with MySQL/MariaDB and PDO:
openssl genrsa -out client-key.pem 4096
I read Everything you need (and don’t need) to know about PHP’s type system, it was interesting. My favourite quote was at the end:
“I believe php’s type system is incredibly rich and carries many innovative and legacy features and they all make much sense when you look at the history of the language development.”
Today I had cause to read about Operator Precedence in PHP. I think I will consider availing myself of the ‘and’ and ‘or’ keywords in future, I haven’t used them myself, although I have seen them before.
It’s very important to remember that PHP caches results of file-system functions. Details are here.
I enjoyed reviewing 10 Popular PHP frameworks in 2020.
Today I learned about mb_strimwidth, very handy in a tight spot. It’s worth a review of the sidebar for other multibyte string options.
I found an interesting article: Linux 25 PHP Security Best Practices For Sys Admins
So to enable profiling on the command line run your script in PHP like this:
php -d xdebug.profiler_enable=1 /path/to/script.php
You need to have configured xdebug in php.ini, I do it with a file in /etc/php/7.2/cli/conf.d/xdebug.ini that looks like this:
;xdebug.profiler_enable = 0 xdebug.profiler_output_dir = "/tmp/xdebug" xdebug.profiler_output_name = "cachegrind.out.%p"
Note: you can enable profiling for all scripts with xdebug.profiler_enable = 1
So I was reading output from
/proc/spl/kstat/zfs/arcstats
and I couldn’t read it easily because the numbers weren’t formatted with thousands separators and I figured I could fix that…
I give you numformat.php. It automatically reformats any input that looks like a number…
There’s more info on the programming@progclub mailing list.
So I migrated my projects from a Debian 8 (Jessie) system to a Debian 9 (Stretch) system. The default NetBeans installed by apt-get install netbeans on Strech was 8.1, and it didn’t include PHP support, so I manually installed NetBeans 8.2.
When I opened my old projects I got an error about an invalid global PHP include path.
So initially I edited ~/.netbeans/8.2/build.properties to change the php.global.include.path settings (to remove /usr/share/php5, because in Stretch I’m running PHP 7.0). But that didn’t work. Each time I ran NetBeans the build.properties file was overwritten with the old php5 directory.
So then I found ~/.netbeans/8.2/config/Preferences/org/netbeans/modules/php/project/general.properties. In there I edited the phpGlobalIncludPath and removed the /usr/share/php5 directory.
Then when I reopened NetBeans all of my projects opened properly without an error! Everything is easy when you know how!