title: OC Benefits slug: oc-benefits description: Today I learned how some mild OCD tendencies tend to help with computers. <!--- authors:
Today I learned how some mild OCD tendencies tend to help me with computers.
In my last post @ /posts/mariadb-meltdown, I upgraded MySQL to version 8.3 and because, for whatever reason... perhaps some mild OCD ( obsessive-compulsive disorder ), I also thought it'd be nice to match up my MySQL and PHP versions since it's rare to share the same numerical version for the latest stable releases. Yes, it may seem like somewhat absurd reasoning, but it makes sense in my brain 🧠.
I'd been on v8.1 for a bit now and I generally like to make major version jumps to save the time and effort of constant upgrades. In the process I also went ahead and matched up my server types because I'd noticed a nagging error in my logs
about the Apache mpm_event module not playing nice with the compiled PHP version.
david@ovid🏛 :/opt/homebrew/etc/httpd(master○) » apachectl configtest
[Thu Jul 18 06:27:21.715896 2024] [php7:crit] [pid 43726:tid 8420412416] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. Homebrew PHP does not support a thread-safe php binary. To use the PHP apache sapi please change your httpd config to use the prefork MPM
AH00013: Pre-configuration failed
Yes, I don't really need the mpm_event
or http2
on my localhost, but again.. the OCD says make it match my servers exactly so the development environment is exactly the same. I run http2 on localhost anyway.
Protocols h2 h2c http/1.1
LoadModule mpm_event_module lib/httpd/modules/mod_mpm_event.so
#LoadModule mpm_prefork_module lib/httpd/modules/mod_mpm_prefork.so
If you're following along or came here from some search term, the solution is to compile a thread-safe version.
brew tap shivammathur/php
brew install shivammathur/php/php@8.3-zts
I just set my ports to match the version under port 9000.
listen = 127.0.0.1:9083
And then I can just use that port 👇🏼 to specify the PHP version per project.
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://localhost:9083/"
</FilesMatch>
And now they match 👏🏼.
david@ovid🏛 :/opt/homebrew/etc/httpd(master○) » php -v
# highlight-next-line
PHP 8.3.9 (cli) (built: Jul 2 2024 14:10:14) (NTS)
david@ovid🏛 :/opt/homebrew/etc/httpd(master○) » pecl list
Installed packages, channel pecl.php.net:
=========================================
Package Version State
imagick 3.7.0 stable
redis 5.3.4 stable
xdebug 3.3.2 stable
david@ovid🏛 :/opt/homebrew/etc/httpd(master○) » mysql --version
# highlight-next-line
mysql Ver 8.3.0 for macos14.2 on arm64 (Homebrew)
Managing a bunch of computers and software isn't easy without being organized. I had someone ask me at lunch yesterday about my schedule... "if it was rigorous?". And although I hadn't ever put much thought into it... Indeed it is. Does my localhost match my servers? Do all of my dotfiles match between machines? Do all my editor themes match? Do my syntax highlighting themes match? Did I go so far as to create my own development inspector to match? Do all of my config files match? Does my editor match my live sites?
YES to all of these. And although I'm fairly confident any professional assessment would leave off the D
because it doesn't seem to be an impairment, a little OC
kinda works for me.