Posts Tagged: php

SOAP Request Generates 500 with Nothing in the Apache or PHP Log

I ran into an odd error to track down. I’ll start off with the fact that I’m not a Soap expert, so this is probably obvious to someone who’s worked with Soap more than myself, but regardless, here’s what happened. I’m setting a new Soap web service, but for some reason I kept getting a… Read more »

Security Upgrade Breaks Composer

While setting up a fresh Symfony installation, I discovered my composer was broken. When I ran this. composer update I got this. The “https://packagist.org/packages.json” file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Failed to enable crypto failed to open stream: operation failed https://packagist.org could not… Read more »

Symfony Rebuild bootstrap.php.cache

If you feel the urge to rebuild your bootstrap.php.cache located in your app directory, run this from the command-line. php ./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php I’ve not actually found rebuilding the cache to be particularly useful. I just needed to it once because I thought it was causing me problems, it wasn’t.

How to Setup a LAMP Stack Using VirtualBox on a Mac

Before I get started, none of what you are about read is necessary if you can setup a bridged network with VirtualBox. The reason I had to do all of this is because I’m on a Macbook Air connecting to the network wirelessly. For some reason, bridged networking with VirtualBox on a Mac using wireless… Read more »

Symfony Suppress Header Output

Here’s how to suppress the header out in a Symfony controller. I was busting out a simple controller to handle the csv download of a log file and I kept getting this in the output. HTTP/1.0 200 OK Cache-Control: no-cache Date: Mon, 01 Feb 2016 21:39:07 GMT The problem was that I was calling render… Read more »

PHP 7 Dropped

I missed the news, but on December 3, PHP dropped version 7. I don’t know what happened to version 6, but version 7 is a major update from PHP 5.6. PHP 7 comes with a new version of the Zend Engine, numerous improvements and new features such as Improved performance: PHP 7 is up to… Read more »

Symfony Exception Display Your Custom Message

Let’s pretend that you don’t want to use the ugly default error pages that come with Symfony. So you create a template to override the default error template and it looks like this. {% extends ‘base.html.twig’ %} {% block body %} <h1>Resource not found</h1> <p>{{ status_text }}</p> {% endblock %} When you’re throwing this exception,… Read more »

PHP’s Foreach is the Fastest

I have always assumed that using PHP’s foreach loop was the easiest, but not the fastest way to loop through an array. I also assumed that the PHP *array_** functions were the preferred method, as the PHP developers would be able to do some super-efficient magic to make these function super fast. Apparently, I was… Read more »

Symfony Upgrades Too Quickly

I love Symfony, it’s definitely my go-to PHP framework, but I don’t like how quickly they drop support for versions. For instance, version 2.6 is already end-of-life and it came out in November 2014. That was like one year ago and we’re all being forced to upgrade to Symfony 3.0. The new version of Symfony… Read more »

How to Use Symfony’s Monolog for Logging

Monolog is the logging bundle for Symfony. It’s super easy to use. You just need to pull in the “logger” service and call the “error” or “info” method. In a controller you could do something like this. $logger = $this->get(‘logger’); $logger->info(“I’m logging over here”); $logger->error(“Who dat err?”); Obviously, you can do a lot more than… Read more »