Stefan KoopmanschapStop Fighting (23.7.2014, 21:15 UTC)

I posted this on Facebook about an hour ago, but this is not limited to Facebook. It should not be. So I’m reposting it here.

Today was a day like any other, except that it wasn’t. It was an official day of mourning in The Netherlands. This morning as I woke up, it was still a day like any other. When I got into my car to drive to work was the first time I noticed a difference: Other music, special requests. As I got to work, nothing was different and actually work was no different. A full day of work, a meeting that lasted until just after 4 o’clock so I completely missed the minute of silence. A day like no other day. Since I went home a bit early on monday and I wanted to finish a couple of tasks that I had left, I stayed a bit longer. That “bit” became quite a bit longer as I ran into a colleague and talked a bit.

I started my way back home in the car. Turned on the radio. Again, the radio felt “odd” yet also comforting because of the special programme. Aside from some tweets and pictures, I had not seen anything of the return of the first victims, I’d not followed it yet. While on the highway, I heard the report of the motorcade of hearses travelling from the airport to the army base where they will try to identify the bodies. Bit by bit, the music, the reports, the tweets, it kicked in.

As I neared the exit of the highway that I need to take to go home, I heard where the motorcade was. A quick calculation later I realized that if I’d stay on the highway, I could reach the route they’d be taking easily. I wasn’t sure. Should I? Isn’t that just sensationalism. I decided it wasn’t. I just wanted to pay my respect, especially since I wasn’t able to join the minute of silence.

I am so glad I did decide to go on. It was a surreal experience. First of all, as I turned onto the highway the motorcade was going to use a bit later, there were thousands and thousands of people standing on the side of the road. Even in the opposite direction, cars were stopping on the side of the road. So many people. Police was trying to ensure safety of people, but they weren’t enforcing the law. Obviously it’s usually not allowed to stop by the side of the road like this. Much respect to the police for the way they handled everything, giving only focus to safety and nothing else.

The motorcade came. That was odd. Strange. Impressive. Fourty hearses, one after the other, several of the drivers with tears in their eyes. I could do nothing but stand there and watch. Silent. Tears in my eyes.

I usually have very little faith in humanity. We’re destroying our world, we’re destroying eachother. What happened is proof of that. But what I felt today, while standing there, the enormous amount of people all there to pay respect, to welcome the dead bodies home, the love, respect and sadness mixed together, shared with everyone there. What a crazy experience. It restored a bit of my faith in humanity. It is possible to have this, unfortunately it will never last long.

I had tears in my eyes for the whole trip home. And as I write this, the tears are again forming. Never, ever in my life will I forget this. But never ever in my life do I ever want to see this many hearses drive by. Ever. Can we please, please all stop fighting eachother?

Christian WeiskeEnable .phar handling in your web server (23.7.2014, 19:10 UTC)

PHP allows us to pack up whole applications in a single .phar file, but no web server software today lets PHP handle .phar files, giving you a download dialog or displaying the text contents of the file.

mod_php on Apache


Open /etc/apache2/mods-enabled/php5.conf and change the line


Corresponding bug report and patch: #639268


Edit /etc/httpd/conf.d/php.conf and add the line

AddHandler php5-script .phar

Corresponding bug report: #1117140

Mac OS X

Open /etc/apache2/others/php5.conf and add the line

AddType application/x-httpd-php .phar

below the similar line ending with .php.



Use the following configuration to make PHP-FPM handle .php and .phar files:

location ~ \.(php|phar)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.+)$;
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;

Be aware of PHP bug #67587. You will get an endless redirection loop for all requests with a non-empty PATH_INFO (file.phar/foo). The fix is already committed and will released with PHP 5.6.0, 5.5.15 and 5.4.31.

Bruno ŠkvorcBest Practices REST API from Scratch – Implementation (23.7.2014, 16:00 UTC)

We ended the first part of this tutorial with all the basic layers of our API in place. We have our server setup, authentication system, JSON input/output, error management and a couple of dummy routes. But, most importantly, we wrote the README file that defines resources and actions. Now it’s time to deal with these resources.

Creating and updating contacts

We have no data right now, so we can start with contact creation. Current REST best practices suggest that create and update operations should return a resource representation. Since the core of this article is the API, the code that deals with the database is very basic and could be done better. In a real world application you probably would use a more robust ORM/Model and validation library.

Continue reading %Best Practices REST API from Scratch – Implementation%

Christian WeiskeExternal auth patches for ownCloud 7 (23.7.2014, 05:42 UTC)

I have an ownCloud installation on my server for several reasons:

  • ownCloud has desktop client applications that sync files automatically onto the server and back between multiple clients (like dropbox).
  • It provides a caldav server for calendar sharing.
  • You may share files with single or groups of people.
  • Web gallery for uploaded image files.

External user authentication

The ownCloud apps repository contains user_external which allows one to authenticate against a FTP, IMAP or SMB server. Since I run my own mail server, authentication against IMAP is my preferred choice to keep my passwords list short.

Unfortunately, users authenticated via IMAP could not login with the desktop client, and could also not get files shared - issues #301 and #302.

A patch

Since this was an unbearable situation, I wrote a patch that creates the users in the database during login. I got an immediate rejection

Determined to solve the problem once for all, I followed the hints and rewrote a large part of the external authentication plugin.

While Thomas Müller, one of the main developers, tested my patch he stumbled across another issue: A blank page without any error notice. Another patch was needed.

One and a half months later, both patches got merged in git master. With ownCloud 7 you'll be able to enjoy them, too.

Cal EvansInterview with Evan Coury (22.7.2014, 21:50 UTC) Link
Christian WeiskeRecent PEAR package releases (22.7.2014, 21:12 UTC)

I wasn't idle since the release of PEAR 1.9.5 but did a bit of work on my PEAR packages.

Net_WebFinger version 0.4.0 now supports the final WebFinger RFC 7033. On pfefferle's request I made both Net_WebFinger and its dependency XML_XRD available on packagist and thus installable via composer: pear/net_webfinger and pear/xml_xrd

Some minutes ago I released version 0.4.0 of the OpenID package. It fixes 6 bugs and adds a new feature.

Bruno ŠkvorcGetting to Know Zend Server 7 (22.7.2014, 16:21 UTC)

Zend Technologies is the company which funds the development of the Zend Engine (the engine PHP is based on), as well as Zend Framework and some other projects like Apigility. They also build proprietary software of high professional caliber, designed for high intensity PHP work in large companies - software like Zend Studio and Zend Server - though both are excellent tools for solo devs as well. In this post, we’ll be taking a look at the latter.

What is Zend Server?

Zend Server is, essentially, a locally-run web application which helps you run, deploy, debug and production-prepare other applications you write. It’s more than a developer helper, though - you can install it on your production servers and have it take care of hosting, clustering, file distribution and more.

It automatically installs Zend Framework (both version 1 and 2 for some reason) and Symfony 2, and supports GUI-based management of other libraries and projects for total ease of use. All operating systems and platforms are supported, and you can install it alongside Apache or Nginx - your choice. You can have it pull in PHP version 5.4 or 5.5, and it will do the rest on its own once you run the installation script.

The latest version of ZS, version 7, comes in several licenses and flavors, so give those a read if you’d like to know about the differences.

The concept of Zend Server might be a bit too abstract to grasp right now if you’ve never encountered it before, so let’s just walk through it instead.

Continue reading %Getting to Know Zend Server 7%

thePHP.ccHHVM: The New PHP? (22.7.2014, 07:00 UTC)
Bruno ŠkvorcBest Practices REST API from Scratch – Introduction (21.7.2014, 16:00 UTC)

The current internet ecosystem has literally been invaded by APIs, and for good reasons. By using third party APIs in your products or services, you have access to a ton of useful features — such as authentication or storage services — that can benefit both you and your users. By exposing your own API, your application becomes “part of the mix” and will be used in ways you’ve never thought before… if you do it the right way, obviously.

In this two part series I’ll show you how to create a RESTful API layer for your PHP applications, using a collection of real world best practices.

The full source code of this project will be available at the end of part 2.

A pleasant UI for developers

First of all, an API is a user interface for developers, so it must be friendly, simple, easy to use and of course pleasant; or else it will end up being another piece of digital junk out there.

Documentation, even in the form of a simple but well written README file, is a good place to start. The minimal information we need is a summary of the service’s scope and the list of methods and access points.

A good summary can be:

Our application is a simple contact list service that manages contacts with linked notes. It has two object types, contacts and notes. Each contact has basic attributes such as first name, last name, and email address. Also, each contact can have a number of markdown-formatted notes linked to it.

Then, it’s a good idea to make a list of all the resources and actions that we are going to implement. This can be seen as the equivalent of wireframing for visual applications. Following the key principles of REST, each resource is represented by a URL, where the action is the HTTP method used to access it.

For example GET /api/contacts/12 retrieves the contact with id of 12, while PUT /api/contacts/12 will update that same contact.

The full list of methods is displayed below:

URL                           HTTP Method  Operation
/api/contacts                 GET          Returns an array of contacts
/api/contacts/:id             GET          Returns the contact with id of :id
/api/contacts                 POST         Adds a new contact and return it with an id attribute added
/api/contacts/:id             PUT          Updates the contact with id of :id
/api/contacts/:id             PATCH        Partially updates the contact with id of :id
/api/contacts/:id             DELETE       Deletes the contact with id of :id

/api/contacts/:id/star        PUT     

Truncated by Planet PHP, read more at the original (another 4631 bytes)

Bruno Škvorc7 More Mistakes Commonly Made by PHP Developers (20.7.2014, 18:00 UTC)

Back at the end of June, TopTal, the freelance marketplace, published a post about 10 Most Common Mistakes PHP Programmers Make. The list wasn’t exhaustive, but it was well written and pointed out some very interesting pitfalls one should be vary of - even if I wouldn’t personally list the mistakes as very common.

I encourage you to give it a thorough read - it has some truly valuable information you should be aware of - especially the first eight points. A couple days back, Anna Filina expanded on the list with seven new entries. While less specific and common, her points still carry weight and should be considered when developing.

X More Mistakes PHP Developers Often Make

I was asked by someone from TopTal to take a look at their list and potentially contribute, and some of our followers on social networks expressed an interest in seeing the list continued, too, so I’d like to take this opportunity to add some of my own entries to this list that I repeatedly need to warn my team members or followers about.

Continue reading %7 More Mistakes Commonly Made by PHP Developers%

LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP