I recently had the need to take a name from a form submission and use it as the display name of the “From” address of an email sent through PHP’s mail()
function. For an address like Toby Example <t@example.com>
, the display name is the Toby Example
part.
php posts
Automatically reconnect PDO when connection times out
In PHP scripts that run queries to a MySQL database over a long period of time, the connection may time out and give a “MySQL server has gone away” error.
Continue reading post "Automatically reconnect PDO when connection times out"Import SQL file in Doctrine / PDO
I recently needed to programmatically import SQL files containing database dumps into a database managed by Doctrine ORM.
Continue reading post "Import SQL file in Doctrine / PDO"New server setup at Cogneato
I’m kind of excited that we moved the first site onto a new server setup at Cogneato. I had worked off and on on the setup for months before we finally went forward with it. It brings a new OS, new host, new software, and a number of other changes to our previous setup.
Continue reading post "New server setup at Cogneato"Today I learned that PHP’s mkdir()
with the octal permission argument apparently doesn’t support any value other than 0
in the leftmost octal spot (where setuid, setgid, and sticky bit go).
FastCGI and “Primary Script Unknown”
If you’re routing requests for script file names through FastCGI, and don’t have some rule to catch requests for unknown scripts, you might find errors like:
Got error 'Primary script unknown\n'
in your error log.
Continue reading post "FastCGI and “Primary Script Unknown”"PHP zend_mm_heap corrupted error
We were getting errors on our server where certain pages or even sites would occasionally or frequently show errors for no apparent reason.
Continue reading post "PHP zend_mm_heap corrupted error"PHP: Fallback for old constructor style
In versions of PHP before 5, constructors were functions with the same name as their class. PHP 5 introduced the __construct()
unified name, and has deprecated the old style in PHP 7. Cogneato still has code remnants from long ago, with the old style. I recently worked on improving the compatibility of our old code with PHP 7.
HTTP 2 on Ubuntu 18.04 with Apache and PHP
I recently got h2 (HTTP 2.0) running on my server.
Continue reading post "HTTP 2 on Ubuntu 18.04 with Apache and PHP"Server upgrade: Ubuntu 18.04
I’ve finally updated my server to Ubuntu 18.04 using do-release-upgrade
.