php

Profiling and Debugging a PHP app with Xdebug and Docker

Profiling and Debugging a PHP app with Xdebug and Docker I have started using an IDE again (PHPStorm) so that I could debug some applications and do some basic app profiling. I want to use Xdebug to profile my PHP apps. I am using Docker Compose on Windows 10. I have made this very complicated for myself but here we go. The directory structure of my app looks like: /build/docker/php/Dockerfile /build/docker/php/php.

Continue reading →

WP Transients must be used responsibly

We ran into an interesting issue with WooCommerce at work. First, here is the subject of the support request we got from our hosting provider: The site is generating ~150MB/sec of transaction logs, filling 500GB of diskspace Holy. Shit. A WordPress site should not be generating that much data. 150MB per second? Wow. How? Why? The simple explanation is that there is a bottleneck in WooCommerce with the filtered layer nav query objects using single transient record.

Continue reading →

TLS Peer Verification w/PHP 5.6 and WordPress SMTP Email plugin

We ran into an issue after upgrading from PHP 5.5 to 5.6. We were no longer able to send email via the awesome WordPress SMTP Email plugin. Turns out that PHP 5.6 introduced some enhancements to its OpenSSL implementation. Stream wrappers now verify peer certificates and hostnames by default. This was causing the form submissions on our site to fail. Clearly there are some issues with our Postfix config and certs.

Continue reading →

Enable status for php-fpm

Accessing the PHP-FPM Status screen is easy enough. First, enable pm.status in your php pool: pm.status_path = /status Then add the following block to your Nginx vhost conf: location ~ ^/(status|ping)$ { access_log off; allow 127.0.0.1; allow 192.168.1.0/24; ##### YOU WILL WANT TO CHANGE THIS TO YOUR IP ADDR ##### deny all; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/var/run/php-fpm-www.sock; } Restart php-fpm and nginx and then browse to http:///status. You will be presented with some useful information on the current status of your PHP-FPM pool.

Continue reading →