Tag: Tips

Dealing with “Too many open files” when running tests with PHPUnit

If you are performing unit tests on large PHP applications with PHPUnit, you may encounter the error “Too many open files”. It happens, don’t take it personally. This error occurs because the OS sets a maximum number of files (also known as file descriptors) allowed to be opened by a process, and inevitably this will […]

August 17 / 2012
Author Kim
Category PHP, Tutorials
Comments No Comments

Generate URLs from within a Twig Extension with Symfony2

It’s possible to generate a URL from within a Twig extension in a Symfony2 application. To do this, you need to have access to the Router. If you have a custom Twig extension, this means that you’ll need to inject the router to the extension. Thanks to the Dependency Injection this is very easy to […]

May 13 / 2012
Author Pablo
Category PHP, Symfony, Tutorials
Comments No Comments
Tags , ,

How to setup multiple PHP versions on Apache

There are several reasons you might need to run multiple versions of PHP on the same server. Maybe you have a PHP 5.2 application running on your server and you need to start working on another application based on a new framework like Symfony2 or Lithium? Perhaps you haver a client with a legacy site […]

August 22 / 2011
Author Kim
Category PHP
Comments 1 Comment

Developer productivity tip: VirtualDocumentRoot

By Pablo Godel If you run a local Apache web server, you are probably familiar with the directive VirtualHost. It allows you to run multiple independent websites on the same machine. I use it all the time to develop my web apps and create fake hostnames, like example.local or site.local which allow me to access […]

July 14 / 2011
Author Pablo
Category PHP, Symfony, Tutorials
Comments 12 Comments
Tags ,

Symfony2 quick tip: generateUrl() with https on nginx

This week we upgraded our Control Panel to the latest Symfony2 code. The upgrade went fairly smooth but some things broke. One of them was the generateUrl() method that creates a link to be used in your templates/controllers. Our code looks like this: $link = $this->generateUrl(‘route_name’, array(‘id’ => $id), true); This should generate a link […]

April 04 / 2011
Author Pablo
Category PHP, Symfony
Comments 1 Comment