Can't find php-fpdf package anywhere? Not installable by pecl, apt nor docker-php-ext-install.
Tested using alpine, jessie and strecth based images.
It doesn't look like anyone has uploaded packages for pecl. There are packages in Debian apt repos, but https://github.com/docker-library/php/pull/542 will prevent you from installing it (see PR for reasons). docker-php-ext-install is for installing modules available from php source that are not already compiled in.
Since it is pure PHP, you should be able to just download and extract the tgz from http://www.fpdf.org/ to the correct spot.
Hmm.. to me it feels a bit strange that if I go and pull official php-something Docker image there are serious issues installing php related extensions with ease.
It is almost easier to start with plain Ubuntu image and pull PHP on that directly with apt. Maybe I just don't get this docker thing right.. I mean I have to install some of the packages directly with apt, some packages with docker-php-ext-install (..and dozens of -dev packages first with apt), some packages I have to pull using pecl and some I have to simply extract from various tar.gz archives.
Shouldn't php images be easier to work with in PHP related things?
@yosifkit gotta agree with @wellu here, this is ridiculous. I have just been searching "the whole internet" for a solution as to why my debian 9 wouldn't find something as simple as php7.2-mysql. I'm trying to be respectful here but I just do not understand why you have to completely bar people from adding their own extensions using the default known commands that you read everywhere.
It's driving me insane that you still can install extensions, but only with docker-php-ext-install that may or may not be documented somewhere, but I certainly did not take any notice of that when I browsed Docker Hub and decided to grab a package that includes PHP 7.2 with FPM for Debian 9.
Being pissed would be an understatement. Your arbitrary and completely pointless decision just cost me an hour. I beg you to undo this pointless barrier...
/edit: Fair enough, I guess it was a case of PEBKAC and failure to properly read the documentation on the Hub after all. It's not what one would expect though, and I'd rather run into issues with the package not working (that I can google and then end up at github.com/docker-library/php/issues rather than having to read the same "tutorials" over and over again where people simply install their extensions via apt-get, thinking I must be dumb or something).
Debian and Ubuntu provide PHP packages. Updates to those packages (for newer PHP versions) are subject to the relevant distribution release policies, which are focused on the stability of the distribution, not on having recent versions of PHP.
Our process is focused instead on providing up-to-date PHP releases directly from PHP upstream, which comes with its own set of tradeoffs. The primary tradeoff is that we thus don't have simple packages that can be installed to get PHP extensions like "php-fpdf". We have a script which we include (and which is documented in the image description on Docker Hub) to compile extensions that are included with the PHP distribution itself. For extensions beyond that, the PHP-upstream supported method for compiling and installing is either PECL or phpize. All of this tends to be more manual than folks are accustomed to with Debian and Ubuntu's packages, but is the official method of consuming PHP from PHP upstream.
What I would suggest is that if that isn't what you're looking for and Debian or Ubuntu's PHP packages are "good enough" for your use case, then you should use them! They're great, but they don't fit the primary use case of the Docker official images program, which isn't to say at all that there's anything wrong with using them.
Hopefully that helps.
Most helpful comment
Debian and Ubuntu provide PHP packages. Updates to those packages (for newer PHP versions) are subject to the relevant distribution release policies, which are focused on the stability of the distribution, not on having recent versions of PHP.
Our process is focused instead on providing up-to-date PHP releases directly from PHP upstream, which comes with its own set of tradeoffs. The primary tradeoff is that we thus don't have simple packages that can be installed to get PHP extensions like "php-fpdf". We have a script which we include (and which is documented in the image description on Docker Hub) to compile extensions that are included with the PHP distribution itself. For extensions beyond that, the PHP-upstream supported method for compiling and installing is either PECL or
phpize. All of this tends to be more manual than folks are accustomed to with Debian and Ubuntu's packages, but is the official method of consuming PHP from PHP upstream.What I would suggest is that if that isn't what you're looking for and Debian or Ubuntu's PHP packages are "good enough" for your use case, then you should use them! They're great, but they don't fit the primary use case of the Docker official images program, which isn't to say at all that there's anything wrong with using them.
Hopefully that helps.