#Php

Archive of blog posts tagged with "php"

  • April 16 2024

    How to change a Users Password via Tinker in Laravel

  • April 15 2024

    A docker based setup for testing with Laravel

    I experienced some annoying issues while running integration tests in a Laravel app. The official MySQL docker image will create a user and a database for you which is very convenient, but that user does not have permission to create new databases. I configure my applications to use a separate database for testing, usually with a _testing suffix and so just hit a brick wall. The solution was to mount an entrypoint script, basically, some SQL statements I want to execute when the container is created. The script will create all of the necessary databases I need.

  • April 14 2024

    Trying to Dispatch Jobs via Tinker with Laravel and SQLite

    In my quest to effectively test Laravel queues and jobs, I've had to navigate through several challenges. Initially, I created a one-off controller action to replay jobs, but the solution was a tad clunky. Next, I attempted to use Laravel's Tinker to interact with my SQLite database, but encountered unexpected I/O errors. Despite a deep dive into the issue and experimenting with different PHP versions, the SQLite errors persisted. Eventually, I decided to switch to MySQL and Docker, which turned out to be an effective solution, finally enabling me to query my database successfully. One key learning from this experience: when using Tinker to dispatch jobs, the appropriate method is to use Bus::dispatch or Queue::push, due to their dependency on garbage collection. All in all, while the journey was filled with obstacles, I'm thrilled to share these insights, with Tinker proving to be an excellent tool for Laravel developers.

  • February 14 2018

    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.

  • January 29 2018

    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

  • September 22 2016

    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. While we sort out those issues, we were able to "solve" our immediate problem, and disabled peer verification in the plugin without editing core files. Thankfully the plugin developer included a filter that would allow us to modify the options array that is passed to PHPMailer.

  • June 8 2015

    Enable status for php-fpm

    Accessing the PHP-FPM Status screen is easy enough. First, enable pm.status in your php pool:

‹ Prev
1
Next ›