What the GPL?!

I’m working on a personal project that I will eventually release under the GNU General Public License (GPL) in order to benefit the community. I would tell you the details of the project, but, since it’s another content management system programmed with PHP, you’d probably ask why we need another one like you need a hole in your head. So, let me humor myself and build it.

In this new project, I’m using the GPL, but I also want to use some of the PEAR packages, which are licensed under the PHP license. Therein lies the problem.

The GNU GPL is a very “copyleft” license. What this means is that the software is licensed in such a way that it requires all modified versions of the software to be redistributed as free software. In this way, the software is protected from being included in any proprietary software; the software created from this software must remain free to benefit the community. There are other free software licenses that do not include this restriction. One such license is the PHP License (a BSD/Apache-style license), which is very non-restrictive and allows you to include any software under it within proprietary software.

There are pros and cons to either license. The biggest pro in using the GPL is that you can be rest assured that the free software movement will continue and that companies cannot use your code in their proprietary software, or, if they do, their code must also be offered under a GPL-compatible license and the source must be made available to end-users. On the other hand, this is also the biggest con with the GPL — people may shy away from it in favor of a less restrictive license.

Likewise, the biggest pro in using the PHP License is that there are no restrictions of this sort. You may use code released under the PHP License in any application you build, proprietary or free. This makes it very easy to use. However, there is a con to this: your code may benefit those money-grabbing capitalists on Wall Street. But that’s not the biggest con. Quite possibly the most important problem with the PHP License is that it is incompatible with the GPL. What does this mean? It means that you can’t distribute code licensed under the PHP License with your GPL’ed application. For this reason, the MySQL libraries will no longer be bundled with PHP 5, nor will MySQL support be enabled by default.

MySQL’s libraries are licensed under the GPL, which, as stated before, is in conflict with the PHP License. Because of this conflict, the decision was made to completely separate MySQL from PHP. This does not mean that end-users cannot use MySQL in their PHP installations. It just means that MySQL will no longer be turned on by default, nor will the MySQL functions be distributed with PHP. (If you’re reading this and just now learning about it, don’t worry — you probably won’t be affected too much since the MySQL libraries come bundled on most systems already. They’re not too difficult to install, at any rate.)

So, if PHP couldn’t include MySQL libraries because of a license conflict, then certainly I couldn’t include PHP-licensed code in my project. I needed to find a solution.

I posted a message to the PHP-general mailing list asking what others have done to include PEAR packages released under the PHP License in their GPL’ed applications. I didn’t receive many responses, but I did receive two different types of responses.

The first type told me to go ahead and include the code in separate files. Those files would remain under the PHP License while my code would be under the GPL. That sounded sensible enough, but it didn’t seem to get around the fact that I would be distributing PHP-licensed code under an overall GPL’ed application.

The second type of answer told me not to distribute the PEAR packages with my application but to include a list of required libraries with links for users to download them. This definitely gets around the licensing issue, but it’s not too inviting for potential users of my application to download twenty or so PEAR packages and install them in the correct locations for my application to find them. There had to be another way, and there was.

I found my answer when I went to the source. I sent an e-mail to the Free Software Foundation (FSF), the folks behind the GNU GPL. They were very prompt in their response, answering me in less than an hour’s time. It also seems that the answer is on their Web site under the FAQs for the GPL. Unfortunately, the site has many FAQs and they are not easy to sift through, nor did I know which question I was asking. This is why I did not find the answer to begin with. However, the response from the FSF pointed me to the correct question and answer: I needed to make an exception to the GPL in my application.

The exception is a permissive statement from me, the copyright holder, to anyone else who would modify and redistribute the application. The exception allows them to include the PHP-licensed PEAR packages in the distribution, and it follows the usual copyright and license notice in the application. It’s worded like this (for the PHP-licensed PEAR packages):

In addition, as a special exception, Ben Ramsey gives permission to link the code of this program with those files in the PEAR library that are licensed under the PHP License (or with modified versions of those files that use the same license as those files), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than those files in the PEAR library that are licensed under the PHP License. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

And there you have it: the exception that allows you to distribute the PEAR packages released under the PHP License with your GPL’ed application. Contrariwise, if you’re using a PEAR package released under the LGPL or the modified BSD license, then you won’t need to include an exception. Both are compatible with the GPL.