PHP

Discover what PHP can do.

PHP What is Opcode Cache and When to Use it

Are you wondering: What is Opcode Cache and When to Use it? I just read an excellent article entitled PHP Performance I: Everything You Need To Know About OpCode Caches published by Engine Yard. The article is a transcript of a video on PHP opcode cache, actually. Engine Yard goes into just enough detail, allowing… Read more PHP What is Opcode Cache and When to Use it

How to Configure a Custom php.ini file for a Website

There are a few ways to create a custom php.ini configuration directives for an apache website. Create a phpinfo.php file with the following content within your document root.

View this file in your browser and look near the top for which Server API is running PHP. If PHP is being run by CGI If the phpinfo.php… Read more How to Configure a Custom php.ini file for a Website

How to Add Current URL from Within Symfony2 Controller

I am building a REST app and wanted to include the resources “href” with every response. Being able to easily do this from with a Symfony2 Controller is very convenient. Here’s the code:

Hope this helped you find it fast!

Drupal Role Specific Development Feedback

On rare occasions you may have to work on a production site and need some development feedback. If you want to control which role sees your output, this snippet can help. With this logic in place, only appropriate roles will see your working on the site.

Drupal Display PHP Errors on One Domain of Multi Site

When using a multi-site setup, You may want errors only to appear for one site. In that case, use $_SERVER[‘HTTP_HOST’] in an if statement to only display PHP error messages for the domain of your choice:

How to Understand PHP Stream Wrapper Context and Options

Some have a difficult time understanding what is meant in PHP by stream wrappers, context options and parameters. Judging by a few conversations with other developers, its obvious there is a bit of confusion about what a stream wrapper is and why it would have a context. While the PHP documentation does adequately describe what… Read more How to Understand PHP Stream Wrapper Context and Options